Commit Graph

12321 Commits

Author SHA1 Message Date
Simon Backx
da24d13601
Added member attribution events and storage (#15243)
refs https://github.com/TryGhost/Team/issues/1808
refs https://github.com/TryGhost/Team/issues/1809
refs https://github.com/TryGhost/Team/issues/1820
refs https://github.com/TryGhost/Team/issues/1814

### Changes in `member-events` package

- Added MemberCreatedEvent (event, not model)
- Added SubscriptionCreatedEvent (event, not model) 

### Added `member-attribution` package (new)

- Added the AttributionBuilder class which is able to convert a url history to an attribution object (exposed as getAttribution on the service itself, which handles the dependencies)
```
[{
    "path": "/",
    "time": 123
}]
```
to
```
{
    "url": "/",
    "id": null,
    "type": "url"
}
```

- event handler listens for MemberCreatedEvent and SubscriptionCreatedEvent and creates the corresponding models in the database.

### Changes in `members-api` package

- Added urlHistory to `sendMagicLink` endpoint body + convert the urlHistory to an attribution object that is stored in the tokenData of the magic link (sent by Portal in this PR: https://github.com/TryGhost/Portal/pull/256).
- Added urlHistory to `createCheckoutSession` endpoint + convert the urlHistory to attribution keys that are saved in the Stripe Session metadata (sent by Portal in this PR: https://github.com/TryGhost/Portal/pull/256).

- Added attribution data property to member repository's create method (when a member is created)
- Dispatch MemberCreatedEvent with attribution

###  Changes in `members-stripe-service` package (`ghost/stripe`)

- Dispatch SubscriptionCreatedEvent in WebhookController on subscription checkout (with attribution from session metadata)
2022-08-18 17:38:42 +02:00
Simon Backx
59851fc1ab Revert "First iteration of adding in post and page columns to event tables"
This reverts commit 26150ca769.
2022-08-18 17:29:40 +02:00
renovate[bot]
02d66ee30a Update dependency date-fns to v2.29.2 2022-08-18 17:15:58 +02:00
Daniel Lockyer
7ce6b27772
Protected Audit Log page behind labs flag
refs https://github.com/TryGhost/Toolbox/issues/356

- even though I was hiding the button, it's better to prevent going to
  the route entirely by redirecting to the homepage if the labs flag is
  not enabled
2022-08-18 17:03:44 +02:00
Daniel Lockyer
7b160493db
Added support for integration actors in Audit Log UI
refs https://github.com/TryGhost/Toolbox/issues/356

- this enables showing when an integration is the actor doing something
- still need to add a fallback for missing icons
2022-08-18 17:00:56 +02:00
Aileen Nowak
e0602b8159 Fixed explore snapshot 2022-08-18 15:50:28 +01:00
Aileen Nowak
2b151db601 Explore in dark mode 2022-08-18 15:50:28 +01:00
Aileen Nowak
cfd71e4f75 Added pink Ghost orb svg 2022-08-18 15:50:28 +01:00
Aileen Nowak
f2fdf9e671 Added accent color to Explore service 2022-08-18 15:50:28 +01:00
Daniel Lockyer
bbb5cd24c8
Added actions events for integrations and webhooks
refs https://github.com/TryGhost/Toolbox/issues/356

- this allows Ghost to collect CRUD events for integrations and
  webhooks, to eventually be shown in the audit log
2022-08-18 16:47:48 +02:00
Fabien "egg" O'Carroll
37ef0582e6 Added members_subscription_created_events table & model
refs https://github.com/TryGhost/Team/issues/1803
2022-08-18 10:45:53 -04:00
Fabien "egg" O'Carroll
03155a61ff Added members_created_events table & model
refs https://github.com/TryGhost/Team/issues/1802
2022-08-18 10:45:53 -04:00
Simon Backx
d01557cdf8 🐛 Fixed comments not visible in activity feed
refs https://ghost.slack.com/archives/C02G9E68C/p1660830163171599?thread_ts=1660829884.159749&cid=C02G9E68C

- Feature flag was still used, causing comment events to get filtered out
2022-08-18 15:46:21 +02:00
Daniel Lockyer
b10ceb75ff
Aligned user's name to cell center 2022-08-18 15:30:11 +02:00
Daniel Lockyer
35f5a38a17
Altered column sizes for audit log table
- this makes the data clearer to see
2022-08-18 15:28:03 +02:00
Daniel Lockyer
62915cccff
Removed brackets from resource IDs
- I don't think they're needed and it's a little cleaner without
2022-08-18 14:22:59 +02:00
Daniel Lockyer
bde9b84221
Fixed page actions events stored as posts
- this was due to the fact that we use the same model for pages as we do
  for posts, so the hardcoded `post` key was not accurate
- this commit adds support for providing a function to return the key for the
  action type
2022-08-18 14:07:04 +02:00
Daniel Lockyer
9fda97550d
Fixed linking users resource
refs https://github.com/TryGhost/Toolbox/issues/356

- some resources don't have titles, like users, so we should optionally
  see if they have a name
- this is starting to become unwieldy so I'll likely pull this logic out
  in an upcoming commit
2022-08-18 13:30:50 +02:00
Daniel Lockyer
fa158b3831
Added link to Audit Log resource
refs https://github.com/TryGhost/Toolbox/issues/356

- this allows you to click on the title and go to whatever resource was
  acted upon
- if the resource has not be found, it'll just show the resource ID
2022-08-18 13:17:21 +02:00
renovate[bot]
5f4c170d05 Update dependency @tryghost/errors to v1.2.15 2022-08-18 12:02:38 +02:00
Daniel Lockyer
f51226e5fb Organized package dependencies
- cleaned up unused dependencies
- adds missing dependencies that are used in the code
- this should help us be more explicit about the dependencies a package
  uses
2022-08-18 11:55:49 +02:00
Daniel Lockyer
aa00fe5474 Cleaned up unused test utils
- cleans up one boilerplate test and some utils that aren't used
2022-08-18 11:55:49 +02:00
Djordje Vlaisavljevic
1c7f38395c Fixed issue with tier card price
refs https://github.com/TryGhost/Team/issues/1806
2022-08-18 10:28:44 +02:00
Daniel Lockyer
ae336f19cd
Protected against missing NODE_ENV variable
- in the event NODE_ENV isn't set, this would throw an error because
  `startsWith` is a function call on `undefined`
2022-08-18 08:34:53 +02:00
renovate[bot]
0f998e30aa Update sentry-javascript monorepo to v7.11.1 2022-08-17 21:53:41 +02:00
Djordje Vlaisavljevic
824d03c803 Updated error message
refs https://github.com/TryGhost/Team/issues/1811
2022-08-17 21:27:02 +02:00
Djordje Vlaisavljevic
0c49fac5f7 Updated new/edit offer form design
refs https://github.com/TryGhost/Team/issues/1811
2022-08-17 21:18:23 +02:00
Djordje Vlaisavljevic
586a912e47 Updated tier form design
refs https://github.com/TryGhost/Team/issues/1791
2022-08-17 21:18:23 +02:00
renovate[bot]
79f28a82a3 Update sentry-javascript monorepo to v7.11.0 2022-08-17 21:16:25 +02:00
Naz
8b46814700 Reworked image sizes cache to work with async cache
refs https://github.com/TryGhost/Toolbox/issues/364

- The caches can be or async nature. Having await syntax allows to  support both types - sync and async.
2022-08-17 19:03:50 +02:00
Djordje Vlaisavljevic
3cb8226100 Added links to help docs
refs https://github.com/TryGhost/Team/issues/1819
2022-08-17 18:23:38 +02:00
Djordje Vlaisavljevic
cceabac8af Added disabled state for radio buttons
refs https://github.com/TryGhost/Team/issues/1811
2022-08-17 18:23:38 +02:00
Rishabh
f000048223 Fixed odd behavior with saving complimentary members
closes https://github.com/TryGhost/Team/issues/1715
refs https://github.com/TryGhost/Members/pull/407

- when comped boolean was brought back for backwards compatibility, it accidentally opened a path from admin to set comped stripe subscriptions on members on save, as Admin always sends back `comped` value
- since we don't allow stripe comped subscriptions anymore, this caused weird behavior with assigning the default tier on comped stripe subscription.
- this change removes the `json.comped` value to be sent up from Admin to avoid any weird comped changes to the member
2022-08-17 20:53:34 +05:30
James Morris
26150ca769 First iteration of adding in post and page columns to event tables
- Adding in dummy column for page or post to various event table places
- This still requires wiring up with real data

refs https://github.com/TryGhost/Team/issues/1815
2022-08-17 16:20:05 +01:00
Djordje Vlaisavljevic
ee3f458053 Switched custom tooltip to standard one
refs https://github.com/TryGhost/Team/issues/1811
2022-08-17 15:23:54 +02:00
Daniel Lockyer
3ce7e241a1
Added fallback icon to audit log
- in the event we don't have a specific icon, I've just chosen to show
  an `info` one for now
2022-08-17 14:54:54 +02:00
Daniel Lockyer
83702c7e86
Added resource to data available to audit log
- this allows us to hydrate the post title into the UI
- needs work to support non-post and missing resources
2022-08-17 14:43:01 +02:00
Kevin Ansfield
2d1d810198 Fetched actor record to display real name when listing audit log events
no issue

- switched `parse-audit-log-event` to a class helper to get access to dependency injection
- added `get actor()` to the parsed event object
  - uses the store to find the related user record, returning an already loaded record if it exists otherwise fetches the record
  - allows use of `event.actor.*` in templates because they are promise-aware and will be filled in once the record is loaded
2022-08-17 14:14:47 +02:00
Djordje Vlaisavljevic
9f294fa900 Switched divs to buttons
refs https://github.com/TryGhost/Team/issues/1811
2022-08-17 13:08:45 +02:00
Djordje Vlaisavljevic
e359d2cb32 Updated new/edit offer form design
refs https://github.com/TryGhost/Team/issues/1811
2022-08-17 12:55:30 +02:00
Peter Zimon
d3fb88ecb3 Open first section by default in email settings
no refs.

- All the sections of the accordion in Email newsletter settings is closed by default. Opening the first section makes the workflow quicker.
2022-08-17 11:42:35 +02:00
Peter Zimon
41484e60a3 Minor Portal settings UX improvements
refs. https://github.com/TryGhost/Team/issues/1813

- All the groups of the Portal settings accordion was closed by default. Opening the first group when showing the modal makes the workflow faster.
- The top heading on the content area had a white background which made the screen visually a bit cluttered.
2022-08-17 11:06:53 +02:00
Peter Zimon
56409d0193 Removed enable/disable logic from offer link
refs. https://github.com/TryGhost/Team/issues/1812

- The "Copy link" button on the Offer detail screen was only enabled once certain fields were filled. This makes unnecessary cognitive load on the end user.
2022-08-17 10:58:24 +02:00
Daniel Lockyer
714611b9fd
Added resource ID to action row
refs https://github.com/TryGhost/Toolbox/issues/356

- this will soon be populated with the actual resource name, if present
2022-08-17 10:53:21 +02:00
Daniel Lockyer
7aecae11cc
Cleaned up multiple implementations of getAction
refs https://github.com/TryGhost/Toolbox/issues/356

- we had a function called `getAction` in every model where we were
  collecting CRUD actions to store in the DB
- this function has the same boilerplate code - make sure it's not
  internal and then construct the object to return
- as we add more actions to more models, we probably want to pull this
  out and just configure the things specific to the model
- this commit pulls out the function into the actions plugin and adds a
  couple of keys to the models to indicate we'd like to store CRUD
  actions, along with the model name
2022-08-17 10:40:34 +02:00
Daniel Lockyer
6c2aebbf0c
Added first version of Audit Log UI
refs https://github.com/TryGhost/Toolbox/issues/356

- skateboard version w/ loading data from API, settings button guarded
  by labs, and a basic UI populating a table with info
2022-08-17 10:16:47 +02:00
renovate[bot]
f348fc3223
Updated @tryghost dependencies (#15235)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-08-17 08:45:47 +02:00
Daniel Lockyer
3cf64a1e78 Switched Mailgun SDK from mailgun-js to mailgun.js
refs https://github.com/TryGhost/Toolbox/issues/363

- this commit switches us to using the official and maintained
  `mailgun.js` SDK, and updates the `mailgun-client` code to reflect the
  changes between the two
2022-08-17 08:45:21 +02:00
Daniel Lockyer
f48a48914a Updated mailgun-client test fixtures
- some of the existing tests return `items` as an empty array
- the upcoming change to switch `mailgun-js` to `mailgun.js` means it's
  more strict about requiring `paging` too
- this commit adds a new empty-response fixture so we can standardize
  using that across tests
2022-08-17 08:45:21 +02:00
Kevin Ansfield
9335b57741 🐛 Fixed line breaks not persisting when used inside email cards
no issue

- we allowed line breaks to be created in the text-replacement html input used inside email cards but they were removed as soon as the card's edit mode was left
- fixed the clean-text-replacement-html routine so `<br>` atoms aren't stripped
- added the soft-return parser to the `<KoenigTextReplacementHtmlInput>` editor options so the `<br>` elements are correctly parsed back into atoms when entering edit mode
2022-08-16 16:56:40 +01:00