Commit Graph

29237 Commits

Author SHA1 Message Date
Simon Backx
e986b78458
Added member attributions to activity feed (#15283)
refs https://github.com/TryGhost/Team/issues/1833
refs https://github.com/TryGhost/Team/issues/1834

We've added the attribution property to subscription and signup events when the
flag is enabled. The attributions resource is fetched by creating multiple relations
on the model, rather than polymorphic as we ran into issues with that as they can't
be nullable/optional.

The parse-member-event structure has been updated to make it easier to work with,
specifically `getObject` is only used when the event is clickable, and there is now a 
join property which makes it easier to join the action and the object.
2022-08-24 10:11:25 -04:00
Daniel Lockyer
ab8952dd46 v5.11.0 2022-08-24 15:04:56 +01:00
Rishabh
968380132b Allowed setting expiry for complimentary subscriptions
closes https://github.com/TryGhost/Team/issues/1727

- allows site owners to give cardless free trials to members by setting expiry on complimentary subscriptions
- also allows complimentary members to upgrade as paid member
2022-08-24 19:24:31 +05:30
Rishabh
326bb97d2c Enabled free trials via tiers and offers
refs https://github.com/TryGhost/Team/issues/1724
refs https://github.com/TryGhost/Team/issues/1726

- allows site owners to add a default free trial period to their tiers
- allows site owners to create custom offers that allow free trials on tiers
2022-08-24 19:24:31 +05:30
Simon Backx
1f11282228
Added backfill migration for members created events (#15294)
closes https://github.com/TryGhost/Team/issues/1836

- Uses the timestamps from the members table to determine the timestamps for the events
- Clears the table when downgrading to prevent having multiple rows for the same member

Co-authored-by: Fabien "egg" O'Carroll <fabien@allou.is>
2022-08-24 09:38:00 -04:00
Rishabh Garg
9abfae2ddb
Switched off email alerts for subscription cancellation by default (#15304)
refs TryGhost/Team#1825

- all sites are expected to have cancellation alerts off by default
2022-08-24 18:54:00 +05:30
Peter Zimon
3231863dc2 Added link on UI for Editors to staff page
refs. https://github.com/TryGhost/Team/issues/1839

- there was no way for an Editor through the Admin UI to be able to invite staff users
2022-08-24 14:23:51 +02:00
Daniel Lockyer
046fd2bd82 Fixed missing options when creating or editing an Offer
- without this, the model doesn't have the context on who was
  adding/editing it
- this resulted in being unable to store actions for Offers because the
  `actor` is unknown
- this is the pattern we use elsewhere in the code so I've copied it
  into here
2022-08-24 13:56:07 +02:00
Peter Zimon
ba5899d147 Audit log list typography updates 2022-08-24 13:49:06 +02:00
James Morris
2724bc0feb Fixed up feature flag and narrow width issues with new post and page table designs
- Made sure feature flag works for new design with table
- Made adjustments to the narrow width look of the table
- Tested across browers and dark mode
2022-08-24 12:34:29 +01:00
Daniel Lockyer
9bdba0250a
Collected Offer CRUD actions
refs https://github.com/TryGhost/Toolbox/issues/356

- this allows collection of CRUD events for Offers but we currently don't
  show them in the UI until it's overhauled to avoid being monotonously
  long
2022-08-24 13:24:13 +02:00
Daniel Lockyer
74e6b4bcf7
Collected Tier CRUD actions
refs https://github.com/TryGhost/Toolbox/issues/356

- this allows collection of CRUD events for Tiers but we currently don't
  show them in the UI until it's overhauled to avoid being monotonously
  long
2022-08-24 12:54:56 +02:00
Hannah Wolfe
21231536cb Removed all remaining bluebird catch predicates
refs: https://github.com/TryGhost/Ghost/issues/14882

- The use of predicates is deprecated, and we're working to remove them from everywhere, so that we can remove bluebird
- This should be the final piece of the puzzle in terms of predicates, from here we can start removing bluebird without concern that a predicate somewhere will explode
- Note: some of this code is poorly tested, but the refactors are very straightforward and minimal
2022-08-24 11:27:09 +01:00
Hannah Wolfe
af94855349 Removed bluebird catch predicates from API endpoints
refs: https://github.com/TryGhost/Ghost/issues/14882

- I found a common pattern where catch predicates were being used to catch non-existent models in destroy methods, and sometimes elsewhere in the API endpoints
- The use of predicates is deprecated, and we're working to remove them from everywhere, so that we can remove bluebird
- In order to still handle these errors correctly, we needed a small change to mw-error-handler so that it can detect EmptyResponse errors from bookshelf, as well as 404s
Note: there is a small change as a result of this - the context on these errors now says "Resource not found" instead of "{ModelName} not found".
- I think this is acceptable for now, as we will be reviewing these errors in more depth later. It's quite easy to make changes, we just have to decide what with proper design input
2022-08-24 11:27:09 +01:00
Peter Zimon
de8f2389cc Rearranged post list table to accomodate stats
- the balance of data vs. status and post title needed adjustment on the post list page
2022-08-24 12:15:33 +02:00
Daniel Lockyer
c6e62b80fa
Protected against missing resource types
- this shouldn't ever be the case, but if we forget to label the
  resource type, we shouldn't proceed with storing the event because
  it'll throw an error
2022-08-24 11:54:28 +02:00
Daniel Lockyer
989c1b7fb4
Removed unused matchdep dependency
- this was only needed when we used Grunt in the Admin package, which I
  removed several releases ago
2022-08-24 11:00:26 +02:00
Daniel Lockyer
ff74f04600
Removed @tryghost/members-csv external import
- this package now lives in the Ghost monorepo so we should just use that
2022-08-24 10:57:48 +02:00
Daniel Lockyer
36c0b7d2bd
Added 60s timeout to Mailgun API calls
refs https://github.com/TryGhost/Toolbox/issues/164

- see referenced issue for more context but Ghost sometimes has issues
  with the email analytics job getting stuck
- we don't provide a timeout to the Mailgun library, so we just
  sit there idling for eternity if something between us and Mailgun is
  causing issues
- this commit adds a 60s timeout so we can at least error out and try
  again next time
2022-08-24 09:13:13 +02:00
Daniel Lockyer
76406f78bb
Added primary_name context for added events
refs https://github.com/TryGhost/Toolbox/issues/356

- we should store the `primary_name` on `added` events too because if
  the resource is eventually deleted, we won't have the pretty name to
  refer to it
2022-08-24 08:53:12 +02:00
renovate[bot]
c860b5b715 Update dependency @playwright/test to v1.25.1 2022-08-24 08:42:13 +02:00
Daniel Lockyer
5e38a23976 Fixed Action event resource_type from page to post
refs https://github.com/TryGhost/Toolbox/issues/356
refs 3a9016639c

- I misunderstood the purpose of a column, and changed the values that
  are inserted into it, which broke relation includes in Bookshelf
- I've since reverted that in the commit above but this migration is to
  fixup the data that got stored in the DB
- we want to replace `resource_type` = `page` back to `post`, but then
  use the `context` column as described in the referenced commit to
  store that the type is actually a `page`, so we can link to it
  from the audit log accordingly
- I'm overwriting the `context` column without taking into account the
  current contents but that's ok because this bug existed before we
  started using `context`
2022-08-24 08:37:51 +02:00
Peter Zimon
04161d2f7d Refined radio buttons on Offer screen
- radio button checkbox and colors were a bit off on Offer screen
2022-08-24 08:32:27 +02:00
Naz
5934794d86 Refactored verification trigger constructor
refs https://github.com/TryGhost/Toolbox/issues/387

- The constructor should be light initialization logic only. Putting business logic into constructor is quite dirty and not really testable!
2022-08-24 14:06:22 +08:00
renovate[bot]
456abc3ef2
Update dependency terser to v5.15.0 2022-08-23 19:47:07 +00:00
Rishabh Garg
c16abbf085
🐛 Fixed empty error csv file for member imports (#15274)
closes https://github.com/TryGhost/Team/issues/1828

- members importer was sending empty error files in case of invalid rows in CSV, hiding both error and affected rows
- fixes typo in `content` option(was `contents` before) passed to attachment (ref - https://nodemailer.com/message/attachments )
2022-08-24 00:49:30 +05:30
James Morris
a3d4c4b3a9 Made some adjustments to fix the feature flag for posts and pages
- There was some spillage from the feature flag
- This has some better handling of various styles

refs https://github.com/TryGhost/Team/issues/1818
2022-08-23 18:42:09 +01:00
James Morris
0596986138 Added in the feature flag for showing status or not
- It's a small thing but it's to hide status in columns for stylistic purposes

refs https://github.com/TryGhost/Team/issues/1818
2022-08-23 18:32:16 +01:00
James Morris
5a9a7accc0 More tweaks to the post table for attribution
refs https://github.com/TryGhost/Team/issues/1818
2022-08-23 18:27:23 +01:00
James Morris
fc0be31c3f Tidied up the styles for the member filtering
- Created a new tag type with max width
- Made sure tags didn't get to large for the box
- Double checked page or post title length

refs https://github.com/TryGhost/Team/issues/1832
2022-08-23 17:44:46 +01:00
Rishabh Garg
c48c65cc88
Added member email alert notification columns for staff (#15276)
refs https://github.com/TryGhost/Team/issues/1825

- adds 3 new columns to users table for storing email alert preferences for member signups/cancellation
- adds column for new member signup alert
- adds column for paid subscription started alert
- adds column for paid subscription canceled alert
- Updated default fixtures and tests for new columns
2022-08-23 22:11:38 +05:30
Daniel Lockyer
46cca8364d
Added integration resource linking
refs https://github.com/TryGhost/Toolbox/issues/356

- now we have an easy way to do it, linking the integration resource in
  is trivial
2022-08-23 18:06:12 +02:00
Daniel Lockyer
7f0996d986
Implemented resource linking in Audit Log
refs https://github.com/TryGhost/Toolbox/issues/356

- we have a very crude version of this before but it just wasn't
  maintainable
- one of the first things I did here was to add `include=resource` on
  the API call, so it returns the fields we need without extra API
  requests
- after we have the id/slug, I could build a route and model array
  dynamically, or return null if we can't redirect to the object (it
  doesn't exist)
2022-08-23 17:48:11 +02:00
Peter Zimon
35ff83afa9 Updated Audit log code block style 2022-08-23 17:38:08 +02:00
Fabien "egg" O'Carroll
0fc0bf40f1 Added ability to filter members by attribution to Admin
refs https://github.com/TryGhost/Team/issues/1832
2022-08-23 11:36:56 -04:00
Fabien "egg" O'Carroll
73466c1c40 Added ability to filter members on conversion attribution
refs https://github.com/TryGhost/Team/issues/1830
2022-08-23 11:36:56 -04:00
Fabien "egg" O'Carroll
83f2bf4757 Added ability to filter members on signup attribution
refs https://github.com/TryGhost/Team/issues/1831
2022-08-23 11:36:56 -04:00
Georg Grauberger
36d9ae36ae
Added secret handling for webhooks (#13980)
closes: https://github.com/TryGhost/Team/issues/1203
refs: https://github.com/TryGhost/Ghost/issues/9942

- Ensures that the webhook secret is validated and saved in Ghost admin
- Then makes use of this value by optionally adding an X-Ghost-Signature header that effectively signs the webhooks
- This allows for verifying the source of a webhook coming from Ghost is truly Ghost.
- Uses the same pattern as GitHub uses: https://docs.github.com/en/developers/webhooks-and-events/webhooks/securing-your-webhooks

Co-authored-by: Hannah Wolfe <github.erisds@gmail.com>
2022-08-23 16:34:32 +01:00
James Morris
c3fb0ef578 More work on the posts table for attribution
- Added in the open rate progress bar
- Columns in place with feature flag
- Moved open rate to tooltip for exact data

refs https://github.com/TryGhost/Team/issues/1818
2022-08-23 15:54:28 +01:00
Daniel Lockyer
f4f757c314
Fixed missing resource type definition
refs 3a9016639c

- this was accidentally missed from the referenced commit
2022-08-23 16:49:11 +02:00
Daniel Lockyer
3a9016639c
Fixed page actions stored under page resource type
refs bde9b84221

- the commit above claimed to fix an issue where actions taken on pages
  were stored using the `post` resource type
- whilst it does that, this actually breaks part of the API because we
  use the `resource_type` to join on tables when doing an
  `include=resource`
- this commit reverts that functionality and instead stores the type in
  the `context` field so we can still differentiate between pages and
  posts
2022-08-23 16:39:47 +02:00
Simon Backx
d91d6c1311
Added attribution counts to Pages API (#15289)
fixes https://github.com/TryGhost/Team/issues/1835

This was missed in the initial pass when adding to the Posts API
2022-08-23 10:26:34 -04:00
Hannah Wolfe
0695f74a65 Fixed some type issues with the api framework
- fixes a bunch of red squiggly lines due to type issues
- this in turn makes it slightly easier to read the API pipeline code
2022-08-23 14:49:29 +01:00
Hannah Wolfe
4cd210c29c Added post deletion tests using new e2e framework
- copied over and rewrote the deletion test from the legacy file
- added a new test that checks that we get a 404 when attempting to delete an unknown post
- this is a guard to protect and futureproof the API whilst we do refactoring to improve 404 handling from bookshelf
- in turn this is aimed at helping to get rid of a bunch of catch predicates from the API
2022-08-23 14:49:29 +01:00
Hannah Wolfe
a2a71c8e67 Renamed e2e admin post tests to legacy
- I want to start rewriting the post tests using the new e2e framework, but it's quite a big task
- For now I have renamed the existing file, and will use the correct file name for writing modern versions of tests
- Note: I have a specific test that I'd like to add which is far easier to write in the new framework
- This change should facilitate moving forward more with the new framework
2022-08-23 14:49:29 +01:00
Daniel Lockyer
9effa119c6 Implemented context on Actions events
refs https://github.com/TryGhost/Toolbox/issues/356

- in order to show data that we might not necessarily still have around
  (ie. when you delete a post, you might want the title), we're going to
  start utilizing the `context` column
- right now, we store the `primary_name` for deleted events, and we also
  store the `setting` `key` and `group` so we can reference it in the
  audit log
2022-08-23 14:58:41 +02:00
James Morris
7f6aa78c01 Tweaking styles for post and pages to work better with more data
refs https://github.com/TryGhost/Team/issues/1818
2022-08-23 13:39:22 +01:00
Simon Backx
934e61aa4c Updated activity feed to use full width
no issue

- Activity feed page now has `gh-main-fullwidth` class
- Page `<title>` is now 'Activity - Ghost' instead of just 'Ghost'
2022-08-23 14:36:48 +02:00
Peter Zimon
d5197fe196 Updated mobile styles for Audit log
refs. https://github.com/TryGhost/Toolbox/issues/356
2022-08-23 13:22:31 +02:00
Aileen Nowak
e5b604cca0 Updated camelCase properties in Explore endpoint to be snake_case 2022-08-23 12:04:07 +01:00