Commit Graph

19 Commits

Author SHA1 Message Date
Simon Backx
b8e43ba675 Removed usage of membersActivityFeed flag
refs https://github.com/TryGhost/Team/issues/1616
2022-05-25 10:37:49 +02:00
Simon Backx
2b01997629 Added newsletter relation to activity feed
refs https://github.com/TryGhost/Team/issues/1478

Makes sure the newsletter relation is returned in the activity feed for susbcribe events (aka newsletter events).
Tests in https://github.com/TryGhost/Ghost/pull/14585
2022-04-26 14:18:34 +02:00
Sam Lord
bf9070f945 Add API verification trigger with new filter
no issue

Previous API verification trigger didn't work because the way filters work also changed. Re-implemented with a new filter.
2022-02-03 15:02:33 +00:00
Thibaut Patel
90faa71cfe 🐛 Fixed typo in getEventTimeline
refs 13a9962ade

- The typo was half-fixed in the commit 13a9962ade
- This fixes the call, restoring the feature
2022-02-02 13:08:15 +01:00
Thibaut Patel
13a9962ade 🐛 Fixed the order of events returned by getEventTimeline
refs https://github.com/TryGhost/Team/issues/1299

- Convert `created_at` to the right column in each function query
- Renamed the misspelled `getEmailDeliveredEvents` function
- Updated existing unit tests to cover the order
2022-02-01 15:47:15 +01:00
Thibaut Patel
da22b31302 🐛 Added the missing payment_event event in getEventTimeline
refs https://github.com/TryGhost/Team/issues/1297

- The function querying for this event type was simply never called.
2022-02-01 11:14:48 +01:00
Thibaut Patel
0acf2f060c Fixed eslint warnings in events.js
no ref

- There were 12 `no-shadow` warnings, renaming the right variables fixed them.
2022-01-25 16:44:29 +01:00
Thibaut Patel
b76c056d33 Removed de-duplication of events in getEventTimeline
refs https://github.com/TryGhost/Team/issues/1277

- When a user signs-up, two events are created, the code was only keeping one of these events.
- This was introduce in commit 58c9c1c649 when the only usage of the function was to extract the 5 most recent events. Any duplication was creating too much noise.
- This was creating issues now that we introduce event filtering. Some `newsletter_event` events would appear from nowhere we we were filtering-out `signup_event` events.
- We removed the deduplication when the `membersActivityFeed` flag is enabled.
2022-01-25 16:38:25 +01:00
Thibaut Patel
d7673bb1ef Moved the event filtering to the database queries
refs https://github.com/TryGhost/Team/issues/1277

- In `getEventTimeline` we filter to only perform the relevant queries, passing to each query function the filters (subset of NQL)
- In each query function, we rewrite the filters to adapt them to the internal data shape.
- We need to do this rewrite to allow API consumers to create filters based on the output on the API instead of the internal data structure.
- Added partial unit tests as there is a lot of repetition between the query functions.
2022-01-25 12:20:34 +01:00
Thibaut Patel
1370682a60 Added a function to parse a NQL subset
refs https://github.com/TryGhost/Team/issues/1277

- This will allow to filter events within `getEventTimeline`
- The subset of NQL has the following rules:
  - Only one level of filters, now parenthesis allowed
  - Only three filter keys allowed
  - No `or` allowed outside of the bracket notation (this is allowed: `type:-[email_opened_event,email_failed_event]` but this isn't: `type:1,data.created_at:1`)
- The return is an object with a NQL filter by allowed filter key
2022-01-24 18:53:14 +01:00
Thibaut Patel
c65a9e0bb2 Moved the getEventTimeline filtering in memory
refs https://github.com/TryGhost/Team/issues/1277

- Doing a filtered DB query wasn't a good solution because we query several tables with different shapes.
- Filtering in memory is done with the NQL library
- Removed the side-effect of changing options.filter for each query, now that options.filter will already contain NQL
- The filtering is done in the reduce function to avoid looping one more time over the in-memory events
2022-01-21 17:56:15 +01:00
Thibaut Patel
5ff5301b1d Fixed the getEventTimeline filtering in case there is no defined filter
refs https://github.com/TryGhost/Team/issues/1277

- `(undefined)` isn't valid NQL so we make sure options.filter is defined
2022-01-21 14:03:33 +01:00
Thibaut Patel
3ad8d9ab8b Added the option to filter events from getEventTimeline
refs https://github.com/TryGhost/Team/issues/1277

- Added the pre-existing framework filters to each event query.
- Made sure we aren't modifying the original `options.filter` to avoid side-effects between event queries.
2022-01-21 11:16:24 +01:00
Thibaut Patel
de0dc7a9a0 Added the full related email in email recipient events
refs https://github.com/TryGhost/Team/issues/1277

- Prevents the admin from doing extra api calls to retrieve the email records
2022-01-19 11:47:35 +01:00
Thibaut Patel
83fe60cb66 🐛 Fixed the email recipient events in getEventTimeline
refs https://github.com/TryGhost/Team/issues/1277

- The members weren't included in the serialized version of the new events
- Some properties weren't using the bookshelf `get` method as they should have
2022-01-19 09:55:02 +01:00
Thibaut Patel
a7098aee46 Added members to all member events in getEventTimeline
refs https://github.com/TryGhost/Team/issues/1277

- This makes the three new email recipient events similar to the preexisting events
2022-01-18 19:02:44 +01:00
Thibaut Patel
ae967c449c Added EmailRecipient events to getEventTimeline
refs https://github.com/TryGhost/Team/issues/1277

- Adds 3 new requests to the `email_recipients` table in the `getEventTimeline` method
- This allows to extract new member events from the table: `email_delivered_event`, `email_opened_event`, `email_failed_event`
2022-01-18 15:53:51 +01:00
Sam Lord
ba2c0818e0 Use @tryghost/logging instead of injected argument 2021-12-02 14:46:58 +00:00
Fabien O'Carroll
d51fdc3f4a Moved code out of index.js in directories
refs https://github.com/TryGhost/Team/issues/879
2021-07-14 14:17:38 +01:00