Commit Graph

15907 Commits

Author SHA1 Message Date
Thibaut Patel
2bfd8f8b7e
Added the post-newsletter relation (#14411)
refs https://github.com/TryGhost/Team/issues/1471

- This is a many-to-one relation so that many posts can be linked to a specific newsletter
- The `newsletters` table had to come first in the schema file so that it's initialized before the `posts` table (because of the foreign key)
- Updated the model to make sure the new field doesn't leak in the API for now
- This migration isn't using the `createAddColumnMigration` util because of a performance issue. In MySQL, adding/dropping a column without `algorithm=copy` uses the INPLACE algorithm which was too slow on big posts tables (~3 minutes for 10k posts). Switching to the COPY algorithm fixed the issue (~3 seconds for 10k posts).
- SQLite isn't using the codepath where we run a raw SQL query because `knex` is doing multiple queries to add/remove a column
2022-04-07 10:26:37 +02:00
Daniel Lockyer
5d17e7b777
Changed auto assignee for TryGhost Members packages
- the most suitable person for these packages is now Rish
2022-04-07 06:10:43 +01:00
Rishabh Garg
90e7887007
Added default newsletter subscription for new members (#14431)
refs https://github.com/TryGhost/Team/issues/1469

Currently, all new members get auto subscribed to the default newsletter. This change adds same behavior with multiple newsletters by auto subscribing all available newsletters on site for new members(If flag is enabled). 
Note: In future, this will also take into consideration the `subscribe_on_signup` flag for a newsletter to filter which newsletters should a member be auto-subscribed.

- adds newsletters service for working with newsletter data
- bumps `@tryghost/members-api` package which handles default subscription
- adds new test fixture/data for newsletters
2022-04-07 08:30:00 +05:30
Renovate Bot
7b01bd0209
Update dependency semver to v7.3.6 2022-04-06 19:42:18 +00:00
Renovate Bot
7926ce56b4 Update metascraper to v5.29.0 2022-04-06 19:41:08 +00:00
Simon Backx
1957b5b789
Removed pagination from members stats endpoint and added extra day to output (#14429) 2022-04-06 17:10:47 +02:00
Hannah Wolfe
0581314796
Fixed location of url service unit tests
- The url service was moved from frontend to server some time ago but the tests were forgotten
- This is only being done now because in 5.0 major changes are happening and it'll be annoying if the
  files move on that branch
2022-04-06 13:05:41 +01:00
Simon Backx
abb3ee48e4
Extended tests for member events (#14333)
refs https://github.com/TryGhost/Team/issues/1372

- Added tests for Stripe webhooks that cancel a subscription (paid and complimentary)
- Tests for manually adding a complimentary member, and removing it again (the 'new' way)
- Added tests for creating new members (paid, complimentary)
- Includes tests for the `stripe_customer_id` property when creating new members (this is broken, fixed by https://github.com/TryGhost/Members/pull/378#issuecomment-1070835800)
- Deduplicated some nock code for Stripe
- Improved event assertions and interference between multiple tests in the giant members test file (by asserting only for the affected member id instead of all events).
2022-04-06 10:40:16 +02:00
Naz
cf8be34c43 Changed frames http module to use async/await
no issue

- It was hard to plug in with additional code into current `.then` based chain. Refactoring to use a more modern syntax helps with readability and allows for easier edits
2022-04-06 14:48:30 +08:00
Renovate Bot
3d40952632
Update dependency @sentry/node to v6.19.4 2022-04-05 20:49:48 +00:00
Renovate Bot
861d1d1d5f Update dependency knex-migrator to v4.2.6 2022-04-05 21:48:39 +01:00
Hannah Wolfe
08479f3816
Moved routing helpers to rendering service
- The helpers folder was full of things used for rendering pages
- It belongs as its own service so that we can see what it really does
2022-04-05 20:12:20 +01:00
Hannah Wolfe
c902d91c81
Renamed rendering service to handlebars
- This fits more closely, as this service is to so with rendering helpers and small parts
- Whereas we want to use "rendering" for things concerned with rendering pages
2022-04-05 20:10:33 +01:00
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