Commit Graph

12385 Commits

Author SHA1 Message Date
Naz
02a0fd5a32 Fixed source attribution for staff token API requests
closes https://github.com/TryGhost/Toolbox/issues/386

- When the API request was made using staff token the source attribution was "user" instead of "api". Misattribution caused ripple effects in  limit service.
- The fix also adds a new combination of data available on the  `req` object - both `user` and `api_key` can be present when the request is done using a staff (user) token. Having both pieces of data on the request object gives more context for business logic, did not find a good reason to keep it "pure" with either `api_key` or `user` property.
2022-08-23 14:38:46 +08:00
Naz
6121451b5d Reused _resolveContextSource method in member update
refs https://github.com/TryGhost/Toolbox/issues/386

- Reusing tontext mapping logic to improve maintainability. It seems like the `update` method was not updated properly or intentionally was left out from  'import' source as that should not ever happen theoretically. Probably the latter is most likely.
- My reasoning on reusing same context to source mapping is: it is better to attribute an appropriate "import" source here. Who knows, maybe we'll have logic in the future where the importer updates instead of skipping existing members. It would not make sense to attribute the source to 'member' in that case, amirite?
- This refactor also makes maintainability of this code way easier
2022-08-23 14:38:46 +08:00
Naz
32343a7adb Extracted context to source mapping logic
refs https://github.com/TryGhost/Toolbox/issues/386

- Before changing the mapping logic it needs to become testable!
2022-08-23 14:38:46 +08:00
renovate[bot]
56da2a2be0
Update dependency tough-cookie to v4.1.0 2022-08-23 02:06:33 +00:00
renovate[bot]
7d5f282e14
Update metascraper to v5.30.3 2022-08-22 22:36:29 +00:00
Daniel Lockyer
43ad4ff814
Removed unused services
- these are not needed
2022-08-22 21:15:21 +02:00
Daniel Lockyer
c459807f9a
Stored action events for settings
refs https://github.com/TryGhost/Toolbox/issues/356

- this enables us to store and filter on actions affecting Settings,
  which will usually be `edited`
2022-08-22 21:12:32 +02:00
James Morris
e56fbdbb57 Better handling of event objects and links with and without feature flag
refs https://github.com/TryGhost/Team/issues/1816
2022-08-22 18:37:49 +01:00
Daniel Lockyer
fa8484ad62
Added webhook as a supported filtering resource
refs https://github.com/TryGhost/Toolbox/issues/356
2022-08-22 19:34:19 +02:00
Daniel Lockyer
c4df99f8a6
Fixed pages unable to be filtered
- this was due to a typo - it should be singular
2022-08-22 19:33:54 +02:00
Daniel Lockyer
6697dcb39a
Allowed Users to be filtered in Audit Log
refs https://github.com/TryGhost/Toolbox/issues/356

- this was missed from the first implementation
2022-08-22 19:31:55 +02:00
Peter Zimon
ef1d7593f5 Updated copy for Audit log table header
refs. https://github.com/TryGhost/Toolbox/issues/356

- there was an inconsistency between the table header and the rest of the UI
2022-08-22 19:18:55 +02:00
Peter Zimon
122ba10114 Updated Activity log list design
refs. https://github.com/TryGhost/Toolbox/issues/356

- The Audit log list had a temporary (POC) design, it needed refinements
2022-08-22 19:15:37 +02:00
James Morris
18186f9ba6 Added in the attribution column for activity page
refs https://github.com/TryGhost/Team/issues/1816
2022-08-22 17:51:01 +01:00
Peter Zimon
3b13c03af2 Fixed Admin lint error 2022-08-22 18:40:49 +02:00
Peter Zimon
b3d2f2ef1f Updated UX for accessing Audit log
refs. https://github.com/TryGhost/Toolbox/issues/356

- The entry for Audit log had been temporarily put on the top level Settings screen. Instead it's now accessible from Settings / General from a generic About box which had been moved from the What's new page. This also required to update the layout of the What's new page a little bit.
2022-08-22 17:56:40 +02:00
Daniel Lockyer
3831d8d479
Fixed pagination in audit log table
- the `created_at` key is stored directly under the object we fetch as
  the last event, rather than a subkey
- this meant we weren't checking the date of the last event correctly,
  which broke pagination
2022-08-22 17:51:34 +02:00
James Morris
e3e613de1c Fixed a linting problem
refs https://github.com/TryGhost/Team/issues/1816
2022-08-22 16:51:03 +01:00
James Morris
3e57f88d12 Added in the attribution column to the dashboard activity under feature flag
- This has the attribution column back into the dashboard activity
- This works only under the member attribution flag
- There are still some issues with event copy

refs https://github.com/TryGhost/Team/issues/1816
2022-08-22 16:28:18 +01:00
Simon Backx
fe3430202a
Fixed member attribution for subdirectories (#15277)
fixes https://github.com/TryGhost/Team/issues/1829

- Remove the subdirectories when creating the Attribution instances
- URLs are now always stored relative to the subdirectory instead of the root directory (makes changing the subdirectory easier)
- Fixed returning absolute urls
- Added tests
2022-08-22 17:16:18 +02:00
Daniel Lockyer
adaecde430
Split event and resource filtering apart
refs https://github.com/TryGhost/Toolbox/issues/356

- events and resources needed to be filtered and sent to the API
  differently
- this commit splits them apart and wires up the toggles to query params
  and therefore API requests
2022-08-22 17:14:34 +02:00
Daniel Lockyer
71e541f2c4
Cleaned up code duplication in Audit Log table
refs b9a42bcb1c (r81841869)

- this makes it clearer to read and cleans up my messy hacks
2022-08-22 16:12:46 +02:00
Daniel Lockyer
30d211fcab
Restricted linking to posts and pages
refs https://github.com/TryGhost/Toolbox/issues/356

- linking is a bit hit-or-miss right now so it's best to only link to
  the resources we can
- this implements a `linkable` attribute on an event to indicate if we
  can link to its page or not
2022-08-22 16:09:56 +02:00
Daniel Lockyer
b9a42bcb1c
Added note when an object is unknown
refs https://github.com/TryGhost/Toolbox/issues/356

- this can occur when the ID in the action event is unknown in the DB,
  and we don't have any other context for it
2022-08-22 15:49:20 +02:00
Daniel Lockyer
68030d4d52
Added basic filtering and searching to audit log
refs https://github.com/TryGhost/Toolbox/issues/356

- this adds some basic filtering and search across the audit log events
- not all of it works, but filtering by objects and searching for users
  should work
2022-08-22 15:41:04 +02:00
Daniel Lockyer
66438ff4ed
Fixed capitalization of API key
- using the resource type verbatim wasn't going to work with `api_key`
  because it needs splitting and capitalizing
2022-08-22 15:41:04 +02:00
James Morris
8b8fa76cc7 Made all the event tables more consistent
- Adjustments to the icon spacing for all tables
- Adjustments to the font weighting and colour for all event tables
- Changed activity on dashboard to have relative time
- Tweaked padding and margins to bring more consistency
- Also fixed a linting bug

refs https://github.com/TryGhost/Team/issues/1816
2022-08-22 13:32:36 +01:00
James Morris
5008a5b948 Added full width to pages and posts with member attribution columns
refs https://github.com/TryGhost/Team/issues/1818
2022-08-22 12:03:53 +01:00
Simon Backx
02168b41ce Improved dependency structure of member-attribution package
refs https://github.com/TryGhost/Ghost/pull/15266#discussion_r950337271

- Moved dependency building to the the service wrapper
- Don't listen for events inside the constructor
- Used a models option to pass around models to make constructors more readable
2022-08-22 11:36:24 +02:00
Simon Backx
0943daad72
Added member attribution to member details page (#15266)
refs https://github.com/TryGhost/Team/issues/1817

Co-authored-by: James Morris <moreofmorris@users.noreply.github.com>
2022-08-19 16:39:18 -04:00
Daniel Lockyer
46870c423f
Merged v5.10.1 into main
v5.10.1
2022-08-19 18:57:59 +02:00
Daniel Lockyer
6ade771a9f v5.10.1 2022-08-19 17:50:40 +01:00
Rishabh
61b4651901 Fixed display of free trial pill on Portal
refs https://github.com/TryGhost/Team/issues/1728
2022-08-19 22:02:12 +05:30
Rishabh
a072d5d0a8 Handled upgrade and expiry of comped subs in Portal
refs https://github.com/TryGhost/Team/issues/1727
refs https://github.com/TryGhost/Team/issues/1728

- allows comped members to upgrade(behind flag)
- shows expiry for comped subs
2022-08-19 21:05:33 +05:30
Rishabh
c19d2d8712 Updated subscription flow to only attach single tier to member
refs https://github.com/TryGhost/Team/issues/1728

- previously, we allowed a member to be mapped to multiple tiers simultaneously as an edge case, in case they managed to signup via another subscription
- since this was always an edge case and not supported, to simplify the flows going forward now that complimentary members can also upgrade, in case of an active subscription we'll always just attach the associated tier to member and remove all other tiers mapped to it
2022-08-19 20:55:31 +05:30
Rishabh
6f2066517b Allowed comped members to go through checkout flow
refs https://github.com/TryGhost/Team/issues/1728

- allows comped members to go through the stripe checkout flow and become a paid member
2022-08-19 20:55:31 +05:30
Daniel Lockyer
b023f716ab
Fixed content-length header in Explore snapshot
- this endpoint returns the Ghost version, of which the minor just hit
  double digits
- because of this, the content-length size changed, and the snapshot was
  incorrect
- we've previously allowed overrides for the content-length to be any number (see
  1fadbacdec)
- this commit allows the header to be any number so it doesn't fail when
  the Ghost version is incremented
2022-08-19 17:14:04 +02:00
Daniel Lockyer
0df8ee8c72 v5.10.0 2022-08-19 16:02:37 +01:00
Hannah Wolfe
809c1a6e08 🐛 Fixed error deleting post with comment replies
closes: https://github.com/TryGhost/Ghost/issues/15252

- comments are deleted when posts are deleted. Without cascade delete on parent_id, replies cannot be deleted
- this change means that deleting a post will delete all comments and replies without error
2022-08-19 15:49:58 +01:00
Sanne de Vries
6fe1b4a0dd Fixed email newsletter dropdown settings getting cut off 2022-08-19 16:44:09 +02:00
Hannah Wolfe
d2acf3aada Fixed attribution table missing on cascade delete
refs: https://github.com/TryGhost/Ghost/issues/15252

- all columns with a foreign key (references prop) must have a deletion strategy
- we just found a bug with this in the comments table - see referenced issue
- this fix adjusts the schema and migration for this change before its released so we don't have to write a horrible migration later
2022-08-19 15:28:45 +01:00
Hannah Wolfe
6d53e40bd9 🐛 Fixed broken email prefs link in comment emails
closes: https://github.com/TryGhost/Ghost/issues/15251

- getAdminUrl is a config helper that returns the direct value from config
- change to using urlJoin and urlFor helpers to generate the correct URL
- not entirely happy with this fix as there's no test, but I've verified it locally
2022-08-19 14:29:35 +01:00
Djordje Vlaisavljevic
30b07087eb Updated copy and spacing
refs https://github.com/TryGhost/Team/issues/1727
2022-08-19 15:09:10 +02:00
Djordje Vlaisavljevic
299d8cf931 Updated copy
refs https://github.com/TryGhost/Team/issues/1724
2022-08-19 15:06:59 +02:00
Djordje Vlaisavljevic
112ddb5d00 Updated copy
refs https://github.com/TryGhost/Team/issues/1726
2022-08-19 15:06:59 +02:00
Rishabh
148fea8217 Wired expiring comp subscriptions on Admin
refs https://github.com/TryGhost/Team/issues/1727

- adds alpha feature flag for expiring comped subs
- adds duration to complimentary subs to set expiry
- shows details for expiring comped subs
2022-08-19 18:20:52 +05:30
Rishabh
fa26f6a783 Added scheduled job to clean expired complimentary subs
refs https://github.com/TryGhost/Team/issues/1727

- runs a daily cron job at start of the day to cleanup all expired comped subs
- removes `members<>products` mapping for expired entries, and updates status for corresponding members
- also adds status events for members going back from comp -> free as a result of expiry
- scope for future optimisation on how the scheduled job is ran or does the cleanup
2022-08-19 18:20:52 +05:30
Rishabh
1258156c38 Handled storing complimentary subscription expiry
refs https://github.com/TryGhost/Team/issues/1727

- if feature flag is enabled, handles storing expiry date on complimentary subscriptions in `expiry_at` column of `members_products`
- updates the expiry value on both member edit or add with tiers
- expiry is passed as `expiry_at` in `tiers` list of a member
- includes `expiry_at` on tiers data of a member when flag is enabled
2022-08-19 18:20:52 +05:30
Rishabh
c123fdf5da Added feature flag for cardless trials
refs https://github.com/TryGhost/Team/issues/1727

- adds alpha flag to toggle cardless trials via expiring complimentary subscriptions
2022-08-19 18:20:52 +05:30
Hannah Wolfe
704f17ff96
Added beta search helper implementation (#15236)
refs: TryGhost/Team#1732

- We're testing out the feasibility of having a {{search}} helper that outputs an pre-styled icon to trigger search.
2022-08-19 12:27:38 +01:00