Commit Graph

15894 Commits

Author SHA1 Message Date
Rishabh
62058730cd Updated yarn.lock 2022-04-05 23:28:49 +05:30
Rishabh
5a3d9ddf2e Wired newsletter preference page in Portal to API
refs https://github.com/TryGhost/Team/issues/1469

- wires newsletter preferences for a member in Portal to view/edit real data
- allows members to control their subscription to multiple newsletters
2022-04-05 22:49:09 +05:30
Rishabh
473775788d Disabled after hook for members newsletters pivot table
refs https://github.com/TryGhost/Team/issues/1469

We have an after hook to update `sort_order` for pivot tables after update as base bookshelf plugin. Since new `members_newsletters` table doesn't has a `sort_order` column on it, this change disables the after hook for it to avoid errors.
2022-04-05 22:23:39 +05:30
Rishabh
16f35df448 Added newsletters to Portal site data
refs https://github.com/TryGhost/Team/issues/1469

- allows Portal access to multiple newsletters on a site
- allows Portal to update member's newsletter subscription preference
2022-04-05 22:23:39 +05:30
Rishabh
cc7c51e140 Handled newsletter data for member api
refs https://github.com/TryGhost/Team/issues/1469

- Added newsletter data handling to member BREAD service
- Allowed updating newsletter data for a member
2022-04-05 22:23:39 +05:30
Rishabh
437d6830aa Added newsletter object to members admin api schema
refs https://github.com/TryGhost/Team/issues/1469
2022-04-05 22:23:39 +05:30
Rishabh
a1417e86b7 Added relation between newsletters and members
refs https://github.com/TryGhost/Team/issues/1469

- updates member model to add relation to newsletter via pivot table
- updates member api serializer to include newsletter data
- updates tests
2022-04-05 22:23:39 +05:30
Daniel Lockyer
e5a7cd974b
Updated lockfile 2022-04-05 16:09:26 +01:00
Hannah Wolfe
e9d6f61029
Moved checks into frontend data service
refs: https://github.com/TryGhost/Ghost/commit/11867ab43

- These checks live in the wrong place. They are mostly a frontend thing
- The only server place they were used was slack and that was fixed in 11867ab43
- Moving these to the frontend they fit neatly into the frontend data service
2022-04-05 15:23:00 +01:00
Hannah Wolfe
11867ab43a
Replaced schema.isPost in slack service /w custom fn
- This is the only piece of server code that relies on the schema.checks, the rest are all frontend
- IMO this code should actually check for the post properties that the slack message needs
- OR it should switch based on the event type
- either way there's no need to have a shared util for this simple use case
- especially becaue it's confusing the use case for it and creating cross-coupling between server and frontend
2022-04-05 14:24:42 +01:00
Hannah Wolfe
4ee2fcd869
Moved frontend data helpers into their own service
- Some of the helpers inside the routing service would be better suited to their own service
- These two helpers fetchData and entryLookup talk to the API to get data & so make a decent start for a data service
- The data service would be the single point of contact with the API for the frontend
- Doing this now cos I'm moving some files around ahead of deleting things for 5.0
2022-04-05 13:38:42 +01:00
Hannah Wolfe
ac32944dc6
Updated migration eslint rule to catch bad filenames
- We had an incident where a migration file was misnamed.
- This is caused by using slimer with spaces rather than hyphens
- We didn't imagine this case when writing the regex for matching filenames
- However, now we know it, it's easy to tweak the regex to match this case
- This requires adding an override to the one badly named file
2022-04-05 11:50:39 +01:00
Hannah Wolfe
aeea3a3d76
Moved eslint override into validations index
- Keeping overrides inside the file means the context of why a rule isn't firing is present inline when modifying a file
- This makes it easier to maintain files, at the cost of needing to search to find all overrides
2022-04-05 11:50:39 +01:00
Naz
33ad7c2740 Cleaned up output errors during tests
refs 2fa3985d42

- Running tests with error logging set to "error" lever, produced a massive amounts of errors related to failed Stripe keys. Making it hard to look through the output.
- When Ghost is running in teste environment by default it is configured with an invalid Stripe key that looks like `sk_test***`. In this case the Members migrations runs creating requiest to Stripe, which fail.
2022-04-05 18:17:47 +08:00
renovate[bot]
ee0b24f154
Update dependency @tryghost/mw-error-handler to v0.1.8 (#14423)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-04-05 10:19:57 +01:00
renovate[bot]
777863f728
Update dependency @tryghost/errors to v1.2.8 (#14418)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-04-05 09:50:21 +01:00
Daniel Lockyer
a109cca55c
Added 5.0 branch to CI trigger
refs https://github.com/TryGhost/Toolbox/issues/273

- ahead of 5.0, we need to make sure we're running development branch tests on CI
2022-04-05 09:31:54 +01:00
Renovate Bot
d41d4699a8 Update dependency knex to v1.0.5 2022-04-05 04:49:10 +00:00
Renovate Bot
8ee67c3d91
Update dependency body-parser to v1.20.0 2022-04-04 13:19:42 +00:00
Rishabh Garg
ee0a6910ce
Added table to store multiple newsletters for member (#14408)
refs https://github.com/TryGhost/Team/issues/1469

With multiple newsletters, members will now be able to subscribe to one or more newsletters on the site. Previously, the subscription to default newsletter for a member was controlled via a single boolean `subscribed` column on the member table.
This change allows mapping multiple newsletters to a member via new pivot table that stores relation between a member and newsletter.

- adds new `members_newsletters` pivot table
- update tests
2022-04-04 18:11:36 +05:30
Daniel Lockyer
eddb77e204
Fixed migration util dropping foreign keys before columns
- if we add a column with a foreign key reference, the `down` migration
  will try to remove that column
- you can't remove a column without deleting the foreign key reference
  first
- our migration utils didn't take that into account and there's nothing
  in Knex to do this for us
- this commit deletes the foreign key before removing the column if we
  have one referenced in the column spec
- also updates the code to pass the column spec into the util
2022-04-04 13:03:38 +01:00
Daniel Lockyer
08701aa7a8
Merged v4.42.1 into main
v4.42.1
2022-04-04 10:40:50 +01:00
Daniel Lockyer
28bc0530d6 v4.42.1 2022-04-04 10:39:50 +01:00
Daniel Lockyer
8135292b8d Updated Admin to v4.42.1 2022-04-04 10:39:50 +01:00
Renovate Bot
a2ad2a668e Update dependency cssnano to v5.1.7 2022-04-04 08:10:47 +01:00
Renovate Bot
8eb903e2b9 Update dependency @playwright/test to v1.20.2 2022-04-04 08:10:39 +01:00
Naz
e3d1507159 Removed accessive id erros in tests
refs 7172db74b0 (r70370252)

- The changes referenced above changed fixtures without taking "test fixtures" in "test/utils/fixtures/fixtures.json" into account. This fix is only cosmetical to unlutter the test output with logging level set to "error". Once the referenced comment is answered a proper fix should be applied here
2022-04-04 10:45:33 +08:00
Daniel Lockyer
2fdf8fd4b6 v4.42.0 2022-04-01 16:00:41 +01:00
Daniel Lockyer
6dddb390bf Updated Admin to v4.42.0 2022-04-01 16:00:40 +01:00
Daniel Lockyer
ef54e4d8b3
Updated all internal packages
- these packages have had minor dependency bumps but we've been force to
  publish them because of Lerna
- this commit updates all pending TryGhost packages ahead of release
2022-04-01 14:57:04 +01:00
Renovate Bot
5129313e31 Update dependency cssnano to v5.1.6 2022-04-01 14:52:08 +01:00
Daniel Lockyer
69b6ba7a68
Fixed symlinked themes missing from list
refs 9f695dc254

- see the referenced commit for context but this resolves symlinked
  themes missing from the list due to a bug in my refactor of
  `@tryghost/package-json`
- the original bump wasn't released yet so this doesn't need to be an emoji
  commit
2022-04-01 14:17:41 +01:00
Naz
7449490a54 Bumped gscan error levels for future version of themes
refs https://github.com/TryGhost/Toolbox/issues/241

 - The changes bring new fatal errors that will become visible with Ghost v5. These are errors with codes: GS001-DEPR-ESC and GS001-DEPR-CURR-SYM.
 - There should be no visible change during theme activation for existing Ghsot version
2022-04-01 18:22:08 +08:00
renovate[bot]
62b5a85830
Update dependency @tryghost/kg-mobiledoc-html-renderer to v5.3.5 (#14400)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-04-01 10:43:02 +01:00
renovate[bot]
47c44eb1c1
Update dependency @tryghost/kg-default-atoms to v3.1.2 (#14397)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-04-01 10:42:51 +01:00
renovate[bot]
bb52012758
Update dependency @tryghost/kg-markdown-html-renderer to v5.1.5 (#14399)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-04-01 09:25:35 +01:00
renovate[bot]
5aa8fbb122
Update dependency @tryghost/kg-card-factory to v3.1.3 (#14396)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-04-01 09:24:53 +01:00
renovate[bot]
d1c0b87d5b
Fixed unquoted src and href attributes in product cards leading to missing __GHOST_URL__ transforms (#14398)
closes https://github.com/TryGhost/Ghost/issues/14344

- Update dependency @tryghost/kg-default-cards to v5.16.2
- contains fix for unquoted `src` and `href` attributes in product cards that are not handled by our URL transform functions

Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-04-01 09:23:40 +01:00
Daniel Lockyer
218950739d
Improved readability of log messages during migrations
- this commit removes the colons from the log messages to make each
  line flow easier when you're reading it
- also removes a couple of superfluous words that aren't needed
2022-04-01 08:57:48 +01:00
Naz
4f7324f1c0 Added a note to potentially breaking price helper
refs https://github.com/TryGhost/Team/issues/449

- Once we deprecate site.lang use in favor of site.locale this helper will need inspection for potentially breaking change. Left a note to come back to it once it's time
2022-04-01 11:33:02 +08:00
Hannah Wolfe
c222d1f64e
Added expectEmptyBody assertions to e2e framework
- Updated express-test to latest version with new expectEmptyBody assertion
- Updated all the tests that used matchBodySnapshot for an empty body to use expectEmptyBody instead
- Updated all the snapshots that were affected manually, and verified running the tests works as expected
2022-03-31 18:56:05 +01:00
Simon Backx
759e362a30 Fixed snakeCase in stats member count endpoint
refs 31c1d4f513

Still had the camel case 🙈
2022-03-31 17:09:28 +02:00
Simon Backx
31c1d4f513 Renamed stats endpoint to /stats/member-count and added totals metadata
refs https://ghost.slack.com/archives/C02G9E68C/p1648737467414789?thread_ts=1648644801.253699&cid=C02G9E68C

- Anything in the API should use snakeCase
- Reduce amount of nesting in endpoint name
- Added totals metadata
2022-03-31 17:05:08 +02:00
Daniel Lockyer
51550c8da3
Fixed logging level when adding permissions to roles
- `info` should be used here because it's an expected point in the code and
  there's nothing to warn about
2022-03-31 15:27:31 +01:00
Thibaut Patel
fdb0e3d44d Added the newsletter API permissions
refs https://github.com/TryGhost/Team/issues/1463

- Allow admins to perform all newsletter operations
- We can adjust and be more permissive in the future if needed
- Added the tests back as permissions are configured correctly now
2022-03-31 16:08:23 +02:00
Simon Backx
ae54352a29
Created new stats service and stats API to get member count history (#14391)
refs TryGhost/Team#1458
refs TryGhost/Team#1459
refs TryGhost/Team#1372

- Added a new stats service, which is divided into several categories. Currently only the 'members' category for member related stats.
- When there are missing or corrupt members status events in the DB, the totals returned by the old member stats endpoint (`/members/stats/count`) were wrong. This is fixed in the new service by counting in reverse order and starting with the actual totals.
- New Stats API, with the new `/stats/members/count-history` endpoint.
- This new endpoint also returns the paid deltas -> dashboard 5.0 will show subscribed and canceled paid members for each day
- Includes tests for the new stats service and endpoint
2022-03-31 16:01:11 +02:00
Thibaut Patel
9e4401d9f6 Added the newsletters endpoint
refs https://github.com/TryGhost/Team/issues/1463

- This enables listing, creating and editing newsletters
- The tests are commented out as the permissions will be added in a follow-up commit
2022-03-31 15:19:58 +02:00
Naz
bf7d141407 🐛 Fixed __GHOST_URL__ tranformations in video cards
refs https://github.com/TryGhost/Ghost/issues/14344

- The video card containing thumbnail images did not pick up url tranformations (aka __GHOSt_URL__) needed to keep urls compatible across Ghost instancess.
- There's also a similar problem with product cards that will get a separate fix
2022-03-31 19:33:26 +08:00
Naz
20913f41c2 Fixed yarn.lock file
refs a6535cf0ab

- When gscan bump was done in the referenced commit yarn did not pick up some of the changes in the lock file.
2022-03-31 19:08:35 +08:00
Naz
a6535cf0ab 🐛 Fixed broken links in some of theme errors
refs https://github.com/TryGhost/gscan/issues/178

 - When a theme with errors or warnings was uploaded the details of the error sometimes contained a broken link leading to a 404. For example, a warning that was visible when use of {{currency_symbol}} was linking to an unexisting page.
 - Along with the version bump there are some performance optimizations and new fatal errors for Ghost's v5 theme checks
2022-03-31 18:46:11 +08:00