Commit Graph

3769 Commits

Author SHA1 Message Date
Daniel Lockyer
f6fb823ce9
Updated all @tryghost packages
- these packages have had minor code changes or dependency updates that
  have forced us to publish the packages in Lerna
- this commit updates all packages in one rollup commit
2022-05-06 12:55:29 +01:00
Renovate Bot
1afe52c657
Update dependency sqlite3 to v5.0.7 2022-05-05 18:34:13 +00:00
renovate[bot]
9aa8e3e7ff
Update dependency @tryghost/url-utils to v3 (#14705)
- updated usage of url-utils.urlFor to work with v3

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Hannah Wolfe <github.erisds@gmail.com>
2022-05-05 16:10:18 +01:00
Naz
648530009d Added use of email templates for version mismatch notifications
refs https://github.com/TryGhost/Toolbox/issues/292

- This change allows to reuse existing pattern present in Ghost on the version mismatch service layer, where we define the contents of the sent email through email templates instead of plain text.
- Apart form templates, there's now failed request URL present in the data passed to the email template along with site title and site url
2022-05-05 18:26:08 +08:00
renovate[bot]
45695ef2d5
Update dependency @tryghost/mw-error-handler to v0.2.4 (#14677)
- Updated accept-version error message copy

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Hannah Wolfe <github.erisds@gmail.com>
2022-05-05 08:57:32 +01:00
Fabien 'egg' O'Carroll
2da52130a6
Removed hasActiveStripeSubscriptions endpoint (#14689)
refs https://github.com/TryGhost/Team/issues/1147

This endpoint is no longer used in 5.0
2022-05-04 17:25:21 +01:00
Simon Backx
473ac3b5a4
Fixed updating a non-existent member internal error (#14658)
refs https://github.com/TryGhost/Team/issues/1580

- When you try to edit a member that doesn't exist, a 500 error is thrown. We should throw a 404 error instead
- This is fixed by https://github.com/TryGhost/Members/pull/395
2022-05-04 13:51:35 +02:00
Simon Backx
ad1ebe6a47
Fixed error when firing Members webhooks (#14645)
refs https://github.com/TryGhost/Team/issues/1577

The last seen at was being updated via the model rather than the
respository, which mean that the default relations were not being
loaded.

This fix updates the repository to load the newseletters relation,
updates the last seen at updated to use the repository and updates the
output serializer to handle missing newsletter relation.

We also update all packages relying on the domain-events package to
ensure that they're all using the same version.

Co-authored-by: Fabien 'egg' O'Carroll <fabien@allou.is>
2022-05-04 12:42:27 +02:00
Naz
c627779948 Extracted email-content-generator into a package
refs https://github.com/TryGhost/Toolbox/issues/292

- Following the concept of having as little code in Ghost core as possible :) The email content generation is also needed to be reused in the version mismatch handling package.
2022-05-04 17:28:09 +08:00
Renovate Bot
7c992ef099
Update dependency express-jwt to v7.6.2 2022-05-03 15:17:44 +00:00
Renovate Bot
073b1f8dad Update dependency postcss to v8.4.13 2022-05-02 06:54:31 +01:00
Renovate Bot
e418630737
Update dependency mocha to v10 2022-05-02 01:29:26 +00:00
Renovate Bot
21b0ab0a8e
Update dependency express to v4.18.1 2022-04-29 21:07:20 +00:00
Daniel Lockyer
67c5395a7f v4.46.0 2022-04-28 15:29:18 +01:00
Simon Backx
104a0f5181
Fixed issue with new members always subscribing to defaults (#14629)
no issue

The member was updated when setting the geolocation, but that also included setting subscribed to true.
2022-04-28 13:21:38 +02:00
Daniel Lockyer
d5e7893212
Updated all @tryghost packages
- these packages contain minor code or dependency updates but we're
  forced to publish them because of Lerna
- this commit rolls up all pending updates into one commit to save noise
2022-04-28 11:54:29 +01:00
Renovate Bot
148779b74c Update dependency knex-migrator to v4.2.8 2022-04-28 11:24:13 +01:00
Renovate Bot
b58e7af65e Updated dependency express-jwt to v7
- also requires a small change to the imports to reflect an API change
2022-04-28 11:15:04 +01:00
Simon Backx
efdc42c257
Fixed bulk unsubscribe and updated member import tests (#14610)
refs https://github.com/TryGhost/Team/issues/1567

**Changes in members-api**
- Compare changes: https://github.com/TryGhost/Members/compare/%40tryghost/members-api%406.1.0...%40tryghost/members-api%406.2.2
- Fixed bulk unsubscribe
- Deletes the newsletter relations instead of setting subscribed to false

**Test fail fix**
refs https://github.com/TryGhost/Ghost/pull/14621
refs https://ghost.slack.com/archives/C02G9E68C/p1651126990299689?thread_ts=1651072733.859939&cid=C02G9E68C

- Events didn't always have the same created_at as created members
- This caused a test to fail randomly in the main repo

**Changes**
- Added required helpers for members-api package
- Version bumps of other packages are only tooling related

**Tests**
- Tests if member import still works with the legacy `subscribed` flag
- Updated member importer to use multipleNewsletters flag
- Dropped legacy members tests
2022-04-28 09:50:05 +02:00
Renovate Bot
ad2903a196
Update dependency sqlite3 to v5.0.6 2022-04-27 21:40:10 +00:00
Fabien 'egg' O'Carroll
810c3077e8
Wired up LimitService to NewsletterService (#14602)
refs https://github.com/TryGhost/Team/issues/1549

This allows us to restrict certain sites to a single newsletter
2022-04-27 17:44:16 +01:00
Simon Backx
21af34a0d4
Added mapping from member subscribed to newsletters on edit/create (#14596)
refs https://github.com/TryGhost/Team/issues/1545

**Changes (`members-api`)**
- Compare via https://github.com/TryGhost/Members/compare/%40tryghost/members-api%406.0.0...%40tryghost/members-api%406.1.0
- Added mapping from member subscribed to newsletters on edit/create
- When editing or creating a member with the subscribed property, it is mapped to the corresponding newletters value
- Defaults to all active newsletters with visibility = members and subscribe_on_signup = true

**Tests**
- Adds test that adds a member with subscribed = true
- Adds test that adds a member with subscribed = false
- Adds test that edits a member with subscribed = true
- Adds test that edits a member with subscribed = false
2022-04-27 17:04:55 +02:00
Simon Backx
2cf76cb031
Added newsletter relation to subscribe events (#14585)
refs https://github.com/TryGhost/Team/issues/1478

**Changes**
- Added the newsletter relation to subscribe events

**Changes in `members-api`**
- Compare: https://github.com/TryGhost/Members/compare/%40tryghost/members-api%406.0.0-alpha.0...%40tryghost/members-api%406.0.0
- Makes sure the newsletter relation is returned in the activity feed for susbcribe events (aka newsletter events).

**Tests**
- Added first test for activity feed to check if the newsletter relation is correctly fetched
2022-04-27 16:44:27 +02:00
Fabien 'egg' O'Carroll
d94859f2e5
Added /stats/subscriptions API (#14547)
refs https://github.com/TryGhost/Team/issues/1505
refs https://github.com/TryGhost/Team/issues/1466

Exposes an API for historical counts broken down by tier and cadence.

Counts backwards from the current stats like MRR to minimize inaccruate
data due to missing/superfluous events.
2022-04-27 14:53:32 +01:00
Renovate Bot
0a5fb7166a Update dependency supertest to v6.2.3 2022-04-27 06:49:47 +01:00
Renovate Bot
eec0c502d9
Update dependency @sentry/node to v6.19.7 2022-04-26 16:27:46 +00:00
Renovate Bot
2d08324238 Update dependency grunt-contrib-clean to v2.0.1 2022-04-26 17:25:59 +01:00
Renovate Bot
863c409ca3 Update dependency @playwright/test to v1.21.1 2022-04-26 17:25:39 +01:00
Renovate Bot
2a5af9c0c5 Update dependency jwks-rsa to v2.1.0 2022-04-26 17:21:23 +01:00
Daniel Lockyer
6747f3a93a Updated @tryghost packages
- these packages contain only code changes or dependency updates but
  we're force to publish new versions due to Lerna's limitations
- this commit bulk updates the packages to save having many commits
2022-04-26 16:54:44 +01:00
Daniel Lockyer
1122ce9cc6
🐛 Fixed credentials issue with SES mail transport
refs 58ace0af76

- please see the referenced commit above for full context but this
  commit bumps `@tryghost/nodemailer`, which contains a fix for reading
  credentials when using the SES mail transport
- credits to @touzoku
2022-04-26 16:40:45 +01:00
Renovate Bot
37f17f9dca Update dependency coffeescript to v2.7.0 2022-04-26 16:29:41 +01:00
Renovate Bot
6937b637ec Update dependency eslint to v8.14.0 2022-04-26 16:29:19 +01:00
Simon Backx
32b0f69e55 Added newsletters to subscribe events (#14579)
refs https://github.com/TryGhost/Team/issues/1478

- Moved all admin API members tests to enable the multiple newsletters flag
- Checks if the susbcribe events are added correctly when adding or removing newsletters
- Checks if susbcribe events are added for default newsletters
2022-04-26 12:31:34 +01:00
Thibaut Patel
48799e1c68 Added the newsletter API ?include=count.posts and ?include=count.members query options (#14525)
refs https://github.com/TryGhost/Team/issues/1524

- This enables admins in the ghost admin to have an overview of the total posts/members associated with a newsletter.
- Follows the `?include=count.x` convention used by other resources
2022-04-26 12:31:34 +01:00
Renovate Bot
65c2958f2a
Update dependency express to v4.18.0 2022-04-25 21:12:45 +00:00
Daniel Lockyer
39f4abbbcd v4.45.0 2022-04-22 16:00:32 +01:00
Renovate Bot
5bd44a05da Update dependency glob to v8 2022-04-22 13:53:15 +01:00
Renovate Bot
98c4956ff4 Update dependency c8 to v7.11.2 2022-04-22 13:51:14 +01:00
renovate[bot]
24d3b7cfd3
Pinned dependency @tryghost/stats-service to v0.1.0 (#14528)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2022-04-22 13:47:19 +01:00
Daniel Lockyer
d0553331db
Switched to commit hash for TryGhost/mock-knex
- I had to fork this dependency to add support for Knex 2.0 but yarn is
  weird and won't bump it if we use `master` because "nothing changed"
- Using a hash should force yarn to pull the changes if the hash gets
  updated
2022-04-22 12:24:02 +01:00
Daniel Lockyer
a394a00618
Fixed date-fns missing as a dependency declaration
refs fccee0614f

- `@tryghost/nql-lang` had `date-fns` declared as a devDependency but it
  was used within the library itself
- the referenced commit moved it to `dependencies` and this commit bumps
  the packages in Ghost
2022-04-22 11:41:48 +01:00
Daniel Lockyer
bead1bbe14 ℹ️ Fixed common build issues with SQLite
- we had to switch to `@vscode/sqlite3` a while back because `sqlite3`
  was unmaintained
- this fork didn't come with prebuilt binaries, so everyone had to
  compile them on their machine
- this brought a lot of issues with installing Ghost
- since then, the Ghost team have picked up maintenance of `sqlite3` and
  Knex has switched back, so we can switch back here too
2022-04-22 10:24:42 +01:00
Naz
7b9a80fbf4 Extracted data access code to external module
refs https://github.com/TryGhost/Toolbox/issues/280

- Keeps the code in the core to the minimum. Ideally we should not be adding any logic apart form "hooking things together"
2022-04-22 16:31:56 +08:00
Naz
b7189a99e4 Added support for version missmatch handling
refs https://github.com/TryGhost/Toolbox/issues/280

- Email notification handling logic needs to be added to Ghost. Ideally there should be as little code landing in the core as possible - mostly data fetching and hooking modules together.
- The primary email handling logic for the `Accept-Version`/`Conent-Version` header missmatch is done in `api-version-compatibility-service` module, and the `mw-api-version-mismatch` allows to intercept request with the missmatch and call the api version compatibility service to do it's job. The mw-error-handler gives each case of client BEHIND or AHEAD of the Ghost version a unique error code, so that the versioning compatibility service has data to distinguish different cases
2022-04-22 16:31:56 +08:00
Renovate Bot
2bde20b7de Update dependency sinon to v13.0.2 2022-04-21 16:32:08 +00:00
Fabien 'egg' O'Carroll
19a08cd11d
Replaced stats service with @tryghost/stats-service (#14527)
- Pulls logic out of Ghost core and into the Analytics repository.
- Test coverage has increased for the stats service
- Interface simplified
2022-04-21 14:57:07 +01:00
Simon Backx
b9646cceb1
Updated members API to return subscriptions' offers from the offer_id (#14515)
refs https://github.com/TryGhost/Team/issues/1520

**Changes in members repo**

Bumped to `5.12.0`, with the following changes:

- Compare differences via https://github.com/TryGhost/Members/compare/%40tryghost/members-api%405.11.1...%40tryghost/members-api%405.12.0
- Instead of doing the matching of the offers and subscriptions by looking at the offer redemptions, we can now look at the offer_id from subscriptions.
- This also fixes an issue where we don't attach the offer object to subscriptions in the members' browse method
- Updated browse behaviour to match the read behaviour of members (product relation needs to get loaded because it is missing in member.products if the subscription is expired).

**Tests**
- Includes test to see if the API correctly returns the offer object when fetching one or multiple members
- Check if the return format is the same for the read, edit and browse members admin API endpoints (offer was missing in subscriptions)
- Snapshot files have been updated because now the offer is returned in subscriptions (content length increased)
2022-04-21 12:06:06 +02:00
Renovate Bot
065078c397
Update dependency express-jwt to v6.1.2 2022-04-20 18:02:43 +00:00
Simon Backx
0c72e78e6a
Stored offer_id in subscriptions (#14488)
refs https://github.com/TryGhost/Team/issues/1519

**Tests:**
- Tests whether the metadata from an offer is read correctly and stored in the database
- Test that invalid offer ids are ignored

**Changes in members repository:** 
- Compare changes here: https://github.com/TryGhost/Members/compare/%40tryghost/members-api%405.9.2...%40tryghost/members-api%405.11.1
- The `offer_id` column of subscriptions is set based on the coupon id from Stripe
- `getByStripeCouponId` method added in the offers repository (required to look up an offer from a stripe_coupon_id)
- the `members-payments` package was bumped twice (once for changes, once for undoing those changes, my bad). Nothing else has changed in that package.
2022-04-19 17:06:53 +02:00