Commit Graph

3252 Commits

Author SHA1 Message Date
Hannah Wolfe
fdf38ba8c6
Initial card asset service implementation
- Requires the new @tryghost/minifier package
- Adds a new service that will handle taking config from the theme and optionally including assets for Koenig editor cards
- It supports both css and js as cards may need one or both
- For any given config, the tool can find the matching files to include and concat and minify them into one file per type
- Currently has an override in place so that this is not yet customisable in the theme - will remove this override when we're ready for the feature
2021-11-04 11:34:40 +00:00
Renovate Bot
f421ee79d8 Update dependency @lodder/grunt-postcss to v3.1.1 2021-11-04 07:33:33 +00:00
Fabien 'egg' O'Carroll
da152a0a13
Removed references to Offers labs flag (#13709)
refs https://github.com/TryGhost/Team/issues/1115

This feature is now GA, and the flag has been hardcoded to `true`, here we clean up the
remaining references as they're no longer needed.
2021-11-03 17:11:48 +02:00
Renovate Bot
0acdbde010
Update dependency @sentry/node to v6.14.0 2021-11-03 11:42:22 +00:00
Fabien O'Carroll
a0cad99a72 Added initial support for Members auto-login
refs https://github.com/TryGhost/Team/issues/1067

When the `membersAutoLogin` labs flag is enabled this will override the
successful redirect URL from Stripe Checkout - and instead use a magic
link, which will log the Member in.

Note that this will only work for brand new members. This is to stop
unauthorized access of Member accounts.
2021-11-03 11:17:02 +02:00
Renovate Bot
ada554e6f0
Update dependency sanitize-html to v2.5.3 2021-11-02 15:59:03 +00:00
Thibaut Patel
3f7448ae38 🐛 Fixed gscan crashing on invalid package.json
refs 7c2c9d54d8

- Gscan won't crash on invalid json, and display the list of failed rules instead
2021-11-02 16:57:26 +01:00
Fabien O'Carroll
b45e514cb1 🐛 Prevented unexecuted migrations from being rolled back
refs https://github.com/TryGhost/knex-migrator/issues/241

Previous to this bump if a migration was occuring across multiple
versions and a migration was to error, we would incorrectly rollback
migrations which had not run yet.

For example - assume we are on v1.0.0 and migrating to v1.3.0, and there are
migrations for v1.1.0, v1.2.0 & v1.3.0. In the case that a migration in
v1.2.0 fails, we will still attempt to rollback migrations from v1.3.0.

This is no longer the case, and we will only roll back migrations which
have already been run.
2021-11-02 16:27:15 +01:00
Renovate Bot
52ee74c16a Update dependency cssnano to v5.0.9 2021-11-02 15:22:27 +00:00
Fabien O'Carroll
0cb551d37b 🐛 Fixed handling of non-subscription invoices
refs https://github.com/TryGhost/Team/issues/887

This updates our webhook handling to ignore invoices which are not
associated with a subscriptions. This stops us from throwing 500 errors
when a Stripe account is used for more than just Member subscriptions,
for example - selling products, or taking one-off payments.
2021-11-02 15:40:03 +02:00
Naz
02da62ee48 Added limit service check for uploaded media filesize
refs https://linear.app/tryghost/issue/CORE-121/create-a-video-storage-adapter

- Uploading large files is costly and might cause DDoS. Limits would allow fair use of the site instance.
- The configureation in hostSettings to enable an "uploads" limit would look like following:
```
"hostSettings": {
    "limits": {
            "uploads": {
                "max": 5,
                "error": "Your plan supports uploads of max size up to {{max}}MB. Please upgrade to reenable uploading."
            }
    }
}
```
- Read more at ba37890be4/packages/limit-service (usage)
2021-11-03 00:33:28 +13:00
Fabien O'Carroll
c45afc7f26 🐛 Fixed email type when creating Members via API
refs https://github.com/TryGhost/Team/issues/1197

We were always sending the 'signin' email, rather than respecting the
email_type param passed to the API. This updates our email sending when
creating members to force the requested type if it's present.
2021-11-02 12:56:00 +02:00
Renovate Bot
30bc2f5090 Update dependency @tryghost/metrics to v1 2021-11-01 12:40:49 +00:00
Daniel Lockyer
46277b6718 v4.21.0 2021-10-29 16:00:28 +01:00
Renovate Bot
083b57a924 Update dependency @tryghost/logging to v1 2021-10-28 19:57:49 +01:00
Renovate Bot
858a9897d4 Update dependency @tryghost/update-check-service to v0.2.5 2021-10-28 17:43:41 +01:00
Renovate Bot
ca2c9b92cd Update dependency @tryghost/email-analytics-provider-mailgun to v1.0.5 2021-10-27 13:41:11 +01:00
Renovate Bot
650c88b3dd Update dependency @tryghost/email-analytics-service to v1.0.4 2021-10-27 12:07:52 +01:00
Daniel Lockyer
f4b48c1373 🔥 Added support for Node 16
refs https://github.com/TryGhost/Toolbox/issues/71

- Node 16 is now LTS so we're adding support in Ghost
- we're also bumping the minimum Node 14 version to 14.17.0 so we can merge
  dependencies who have higher Node 14 requirements than current
- this commit adds Node 16 to the `package.json` engines and to CI
- also bumps all dependencies that needed new versions to add Node 16
  support
2021-10-27 11:39:42 +01:00
Thibaut Patel
1b01036458 Removed the theme settings lab flag in gscan
refs https://github.com/TryGhost/Team/issues/1164

- theme settings are GA now
2021-10-26 17:46:29 +02:00
Daniel Lockyer
6802a61307
Merged v4.20.4 into main
v4.20.4
2021-10-26 13:21:41 +01:00
Daniel Lockyer
db4951795b v4.20.4 2021-10-26 13:20:31 +01:00
Thibaut Patel
5d9e237951
🐛 Fixed GScan crash on files starting with package.json
refs https://github.com/TryGhost/Team/issues/1185

- gscan was attempting to json parse all files starting with package.json
2021-10-26 12:03:54 +01:00
Thibaut Patel
82e42bfc8b
🐛 Fixed GScan falsely triggering the "unused theme setting" error
refs https://github.com/TryGhost/Team/issues/1183

- This gscan rule wasn't parsing the partials where the theme setting was used
2021-10-26 12:03:45 +01:00
Kevin Ansfield
b6f9a19b25
🐛 Fixed error from custom settings sync when theme name contains . chars
no issue

- bumped `@tryghost/custom-theme-settings-service`
- contains a fix for invalid filter strings being generated for theme names that contain `.` by wrapping the name in quotes, eg `theme:'4.1.1-my-theme'`
2021-10-26 12:02:52 +01:00
Thibaut Patel
e851e28b16 Fixed gscan crash on files starting with package.json
refs https://github.com/TryGhost/Team/issues/1185

- gscan was attempting to json parse all files starting with package.json
2021-10-26 12:23:11 +02:00
Thibaut Patel
e4ce745ab6 🐛 Fixed gscan falsely triggering the "unused theme setting" error
refs https://github.com/TryGhost/Team/issues/1183

- This gscan rule wasn't parsing the partials where the theme setting was used
2021-10-26 11:20:05 +02:00
Kevin Ansfield
af4c115fb3 🐛 Fixed error from custom settings sync when theme name contains . chars
no issue

- bumped `@tryghost/custom-theme-settings-service`
- contains a fix for invalid filter strings being generated for theme names that contain `.` by wrapping the name in quotes, eg `theme:'4.1.1-my-theme'`
2021-10-26 10:18:47 +01:00
Fabien O'Carroll
960828b646 Removed handling of invoice.payment_failed webhook
refs https://github.com/TryGhost/Team/issues/885

This webhook was not used to populate data, and was causing 404's when
checkout sessions were completed, but payment had failed. Removing it
should fix these 404's.
2021-10-25 14:34:45 +02:00
Fabien O'Carroll
a68b96001c Fixed max-complexity-warnings for members API
no-issue

This removes logic from the Members API controller, and into the Members
BREAD service, this allows our controllers to be simpler and easier to
maintain, as well as keeping the important logic all together.
2021-10-25 14:06:12 +02:00
Daniel Lockyer
cfb5323017
Merged v4.20.3 into main
v4.20.3
2021-10-25 11:32:31 +02:00
Daniel Lockyer
6f0357e670 v4.20.3 2021-10-25 10:28:23 +01:00
Kevin Ansfield
8e2568c776 🐛 Fixed error when a theme does not have a "config" object in it's package.json
no issue

- bumped `gscan` to version with an added guard check where it extracts custom theme settings from `config.custom`
2021-10-25 10:08:35 +01:00
renovate[bot]
d266dfe291
Update dependency @tryghost/members-api to v2.4.4 (#13670)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-10-25 10:05:37 +02:00
Daniel Lockyer
7302fc615c
Merged v4.20.2 into main
v4.20.2
2021-10-25 09:20:57 +02:00
Daniel Lockyer
3067fbe97c v4.20.2 2021-10-25 08:19:06 +01:00
Renovate Bot
54dba233f6
Update metascraper to v5.25.0 2021-10-25 03:52:14 +00:00
Daniel Lockyer
dfe207812d v4.20.1 2021-10-22 20:08:55 +01:00
Renovate Bot
3b773c2ab5
Update dependency oembed-parser to v1.4.9 2021-10-22 16:21:39 +00:00
Daniel Lockyer
9eaada9384 v4.20.0 2021-10-22 17:19:48 +01:00
Fabien O'Carroll
c3694c9903 Improved error messages for Offers API
no-issue

The error messages for duplicate Offer name and code were not
particularly helpful. This includes an update to them based on feedback
from Peter.
2021-10-22 16:50:48 +02:00
Renovate Bot
b2e95ba12a Update dependency @tryghost/metrics to v0.2.6 2021-10-22 15:50:35 +02:00
Renovate Bot
b467d45c5c Update dependency @tryghost/image-transform to v1.0.17 2021-10-22 15:47:28 +02:00
Renovate Bot
0bacf3ef69 Update dependency @tryghost/config-url-helpers to v0.1.3 2021-10-22 15:45:52 +02:00
Renovate Bot
e188c6bd9f Update dependency @tryghost/zip to v1.1.18 2021-10-22 15:45:12 +02:00
Renovate Bot
e7e1568a9c Update dependency @tryghost/mw-session-from-token to v0.1.26 2021-10-22 15:44:28 +02:00
Renovate Bot
9e5de91dc1 Update dependency @tryghost/limit-service to v0.6.5 2021-10-22 15:43:14 +02:00
Renovate Bot
742b5f7dd3 Update dependency @tryghost/package-json to v1.0.6 2021-10-22 15:41:53 +02:00
Renovate Bot
2208ae1655 Update dependency @tryghost/security to v0.2.13 2021-10-22 15:41:43 +02:00
Renovate Bot
0e4be5a390 Update dependency @tryghost/job-manager to v0.8.11 2021-10-22 15:39:15 +02:00
Renovate Bot
cceda95ba0 Update dependency @tryghost/bootstrap-socket to v0.2.13 2021-10-22 15:21:54 +02:00
Renovate Bot
7b43e30d8e Update dependency @tryghost/adapter-manager to v0.2.18 2021-10-22 15:04:47 +02:00
Renovate Bot
d842259f22 Update dependency @tryghost/errors to v0.2.17 2021-10-22 15:04:38 +02:00
Renovate Bot
da6a66c777 Update dependency @tryghost/constants to v0.1.12 2021-10-22 15:04:30 +02:00
Renovate Bot
ff09230382 Update dependency @tryghost/promise to v0.1.13 2021-10-22 15:04:10 +02:00
Renovate Bot
51d6cf3922 Update dependency @tryghost/session-service to v0.1.28 2021-10-22 15:03:59 +02:00
Renovate Bot
b57dcf9a98 Update dependency @tryghost/vhost-middleware to v1.0.19 2021-10-22 15:03:47 +02:00
Fabien O'Carroll
70f7039539 Handled empty Offer titles
no-issue

We want to allow for Offers titles to be blank/empty. This updates the
API to handle both null & empty strings for the Offer title.
2021-10-22 14:18:01 +02:00
Renovate Bot
4d56e9a7af Update dependency @tryghost/version to v0.1.7 2021-10-22 13:22:24 +02:00
Renovate Bot
8a6640d00f Update dependency @tryghost/request to v0.1.8 2021-10-22 13:08:36 +02:00
Renovate Bot
6d2de5b369 Update dependency @tryghost/debug to v0.1.9 2021-10-22 13:08:28 +02:00
Renovate Bot
2deb396291 Update dependency @tryghost/metrics to v0.2.5 2021-10-22 13:00:59 +02:00
Renovate Bot
f82f52a9e7 Update dependency @tryghost/bookshelf-plugins to v0.3.4 2021-10-22 13:00:17 +02:00
Renovate Bot
2ea8c5ee5b Update dependency @tryghost/validator to v0.1.8 2021-10-22 12:59:45 +02:00
Renovate Bot
842c850534 Update dependency @tryghost/nodemailer to v0.3.6 2021-10-22 12:27:45 +02:00
Renovate Bot
fe191a0f96 Update dependency @tryghost/root-utils to v0.3.7 2021-10-22 12:25:56 +02:00
Renovate Bot
113e01c2c4 Update dependency @tryghost/tpl to v0.1.8 2021-10-22 12:25:42 +02:00
renovate[bot]
c95ce4c685
Update dependency @tryghost/members-csv to v1.1.8 (#13642)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-10-22 12:03:56 +02:00
renovate[bot]
967f34f4e0
Update dependency @tryghost/express-dynamic-redirects to v0.2.1 (#13640)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-10-22 11:18:24 +02:00
renovate[bot]
be100d24ce
Update dependency @tryghost/magic-link to v1.0.14 (#13641)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-10-22 11:18:11 +02:00
renovate[bot]
cafbd01611
Update dependency @tryghost/members-importer to v0.3.4 (#13643)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-10-22 11:17:53 +02:00
Renovate Bot
a2b4ccb0ad Update dependency @tryghost/email-analytics-provider-mailgun to v1.0.4 2021-10-22 08:54:28 +02:00
Renovate Bot
1be8d30f44
Update dependency eslint-plugin-ghost to v2.7.0 2021-10-21 21:06:14 +00:00
Fabien O'Carroll
c10e76aa2c Included Offers on Member Subscriptions
refs https://github.com/TryGhost/Team/issues/1135

This adds Offer information to Subscriptions for which the Offer is
valid. This means that if a Subscription has changed its Tier/Cadence
from the what the Offers supports - it will not be attached. The data
however is still stored in the db.

This also fixes a bug with creating Stripe Checkout Sessions without an
Offer.
2021-10-21 18:12:32 +02:00
renovate[bot]
28283b54ac
Update dependency @tryghost/members-ssr to v1.0.15 (#13644)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-10-21 17:00:10 +02:00
Renovate Bot
39706126c0 Update dependency postcss to v8.3.11 2021-10-21 16:50:51 +02:00
Fabien 'egg' O'Carroll
21ec444139
Handled Stripe Disconnect for Offers (#13638)
refs https://github.com/TryGhost/Team/issues/1166

This updates the Members & Offers modules to correctly handle
disconnecting from Stripe, this includes:

 - Deleting Stripe data on disconnect (coupons for Offers)
 - Recreating missing Stripe Coupons after disconnect/reconnect
2021-10-21 16:25:35 +02:00
Renovate Bot
8709da36e9 Update dependency @tryghost/email-analytics-service to v1.0.3 2021-10-21 15:25:51 +02:00
Renovate Bot
8dc31438b3 Update dependency analytics-node to v5.1.2 2021-10-21 12:08:00 +02:00
Renovate Bot
87b0af1de7 Update dependency postcss to v8.3.10 2021-10-21 12:07:45 +02:00
Daniel Lockyer
32b325eb4c Added codecov.io coverage uploader to CI
refs linear.app/tryghost/issue/CORE-74/improve-the-test-situation

- this commit adds the codecov GitHub Action into CI so we can upload
  coverage reports
- the coverage files need to be in XML for them to work with
  codecov, so this commit also adds cobertura (XML) as a reporter
2021-10-20 15:12:07 +02:00
Kevin Ansfield
59a6f040d2 Fixed custom theme settings being clobbered with duplicate-named themes
refs https://github.com/TryGhost/Team/issues/1149

Ghost allows different themes to have the same `name` value in `package.json` but gives them a custom name based on the zip file used to upload it. The custom theme settings service however was always using the package.json name meaning that when syncing a theme with a duplicate name it was overwriting the settings for all other themes.

- bumped `@tryghost/custom-theme-settings-service` which changes the `.activateTheme()` signature to accept a theme name as the first argument
- updated our calls to `.activateTheme()` to pass Ghost's known theme name as the first argument so we're always syncing with the correct `theme` field value in the `custom_theme_settings` table
2021-10-20 13:25:02 +01:00
Thibaut Patel
c273727b5f Added api validation for custom settings
refs https://github.com/TryGhost/Team/issues/1107 https://github.com/TryGhost/Team/issues/1106

- Replicates the gscan custom theme settings validation in the admin api.
2021-10-20 13:36:41 +02:00
Renovate Bot
5524509274 Update dependency nock to v13.1.4 2021-10-20 10:22:32 +02:00
Daniel Lockyer
1fd980ee9b Set global Luxon timezone override to UTC
refs https://linear.app/tryghost/issue/CORE-113/start-off-luxon-refactor

- we're planning on switching to Luxon for our date/timezone library,
  eventually replacing `moment` and `moment-timezone`
- the first step is to set the global timezone override to UTC, which is
  done in `core/server/overrides.js`
- also adds a test to ensure we're setting the timezone correctly
- this was mostly pulled from https://moment.github.io/luxon/#/zones?id=changing-the-default-zone
2021-10-20 09:19:29 +02:00
Fabien O'Carroll
d303c40248 Fixed editing Offer description via API
no-issue

We were only updating the Offer description if it was truthy - rather
than if it existing, this resulting in empty strings or null not working
correctly.
2021-10-19 11:11:02 +02:00
Thibaut Patel
2891898f94 Added a rule to forbid the custom theme setting image type to have a default
refs https://github.com/TryGhost/Team/issues/1108

- The default is something that the theme developpers should be coding in the template rather than using a default value
2021-10-19 09:41:35 +02:00
Fabien O'Carroll
c5856d04e4 Added support for redemption_count to Offers API
refs https://github.com/TryGhost/Team/issues/1132

This adds redemption_count to the Offers API so that we can display how
many times an Offer has been used. This also adds the storage mechanism
for Offer Redemptions - which ensure that everytime a Checkout Session
is completed - we will create the Offer Redemption in the database.

This means that manual usage of the underlying will not count toward the
Offer redemption count, this is considered an edge case.
2021-10-18 17:40:05 +02:00
Daniel Lockyer
f9f0fb34f2
Merged v4.19.1 into main
v4.19.1
2021-10-18 15:10:22 +02:00
Daniel Lockyer
5c5233afc0 v4.19.1 2021-10-18 14:09:17 +01:00
Fabien O'Carroll
67b517e1fb 🐛 Fixed handling of "incomplete" subscriptions
refs https://github.com/TryGhost/Team/issues/1156

When a payment fails but Stripe Checkout succeeds, a subscription is
created in the "incomplete" status. This would result in a Member not
being linked to the Product. When the subscription was later updated to
"active" or trialing - the Product would still not be added!

This updates the members-api to always link the Product to the Member
for active subscriptions - regardless of if they're new or not.
2021-10-18 14:39:28 +02:00
Renovate Bot
5d60b564af
Fixed double logging library initialization
- we have the `@tryghost/logging` library to manage logging across all
  our code
- this package is intended to be a singleton, otherwise we have multiple
  versions of logging loaded
- we sometimes have problems where dependencies also use
  `@tryghost/logging` but Ghost's yarn.lock is not regenerated to update
  this
- this means we have multiple versions of `@tryghost/logging` running
- this commit updates the dependency @tryghost/update-check-service to
  v0.2.4 to clean up the yarn.lock of multiple versions
2021-10-18 14:28:26 +02:00
Renovate Bot
c768133357 Update dependency jwks-rsa to v2.0.5 2021-10-18 08:29:43 +02:00
Daniel Lockyer
f4fb0fcbaa Improved Ghost boot time and memory usage by lazy loading routes
no issue

- right now, we mount all API endpoints (v2, v3 and canary), alongside some
  other routes, when Ghost is booting. This is wasteful because we don't
  necessarily need any of the endpoints to get Ghost up and running
- even when Admin is used, it uses `canary` so `v2` and `v3` sit in memory
- the better approach here is to lazy load these endpoints, so they only
  get mounted when needed
- this commit adds the `lazyUse` function into our Express lib,
  which takes a mount path and a module function to execute down the
  line. This gets passed to the wonderful `express-lazy-router` lib which
  detects when we're calling an unmounted module and will mount it for
  us
- from local testing, this speeds up boot time by about 18% and reduces
  initial memory usage by about 6% 🚀
2021-10-15 17:52:07 +02:00
Daniel Lockyer
cea17cfb31 v4.19.0 2021-10-15 16:23:19 +01:00
Renovate Bot
d44666fe11
Update dependency mocha to v9.1.3 2021-10-15 12:26:03 +00:00
Thibaut Patel
3d57ac4464 Moved the match helper to GA in gscan. Updated the custom theme select gscan rule to work with the updated match behavior.
refs 50134193be
refs c3b346bb1a
2021-10-14 18:45:00 +02:00
Renovate Bot
565ced555c Update dependency @tryghost/custom-theme-settings-service to v0.1.2 2021-10-14 17:11:58 +02:00
Renovate Bot
c8082c9c43 Update dependency @tryghost/metrics to v0.2.4 2021-10-14 17:11:27 +02:00
Thibaut Patel
2748ed6d0a Fixed a gscan check to force custom theme setting of type color to always have a default value
ref e6a477b3b5
2021-10-14 14:51:44 +02:00
Renovate Bot
107f519310 Update dependency @tryghost/request to v0.1.7 2021-10-14 14:41:34 +02:00
Renovate Bot
aa67e2d463 Pin dependency gscan to 4.7.0 2021-10-14 14:17:57 +02:00
Fabien O'Carroll
d3e291eea6 Fixed Offer usage with Stripe Checkout
no-issue

An update in the MembersAPI meant that coupons were not correctly being
passed to Stripe Checkout. This bump contains the fix to ensure they
are.
2021-10-14 12:09:58 +02:00
Thibaut Patel
a9be1d41c3 Added two gscan rules to validate defaults for custom theme settings of type boolean and color
ref f67fbdf2b4
2021-10-14 11:55:32 +02:00
Renovate Bot
78d322b935 Update dependency @tryghost/bookshelf-plugins to v0.3.3 2021-10-14 11:11:13 +02:00
Renovate Bot
edc12ea128 Update dependency @tryghost/version to v0.1.6 2021-10-14 11:11:01 +02:00
Renovate Bot
cfdd379ddd Update dependency @tryghost/metrics to v0.2.3 2021-10-14 10:04:49 +02:00
Renovate Bot
5438b32155 Update dependency @tryghost/debug to v0.1.8 2021-10-14 10:04:38 +02:00
Renovate Bot
7c4963b579 Update dependency @tryghost/tpl to v0.1.7 2021-10-14 10:04:08 +02:00
Renovate Bot
60adebd815 Update dependency @tryghost/validator to v0.1.7 2021-10-14 10:03:57 +02:00
Renovate Bot
3f9278943c Update dependency @tryghost/root-utils to v0.3.6 2021-10-14 10:03:34 +02:00
Renovate Bot
a3d202fee1 Update dependency @tryghost/logging to v0.2.2 2021-10-14 10:03:26 +02:00
Renovate Bot
2a58e72d10 Update dependency @tryghost/nodemailer to v0.3.5 2021-10-14 10:03:12 +02:00
Renovate Bot
7499641843
Update dependency sanitize-html to v2.5.2 2021-10-13 19:23:34 +00:00
Thibaut Patel
dc4694d8d3 Added a gscan check to prevent the declaration of unused custom theme setting
ref 136e02adfd
ref https://github.com/TryGhost/Team/issues/1105

- Custom theme settings are defined in package.json, this rule triggers an error if a defined rule doesn't appear in any handlebars templates.
2021-10-13 18:30:58 +02:00
Daniel Lockyer
64f2aa2af5
Updated @tryghost/metrics dependency
no issue

- this adds in some missing dependencies of `@tryghost/metrics`
2021-10-13 14:48:05 +02:00
Fabien O'Carroll
7722780539 Restricted archived Offers from being used for Checkout
refs https://github.com/TryGhost/Team/issues/1133

This updates the MembersAPI Checkout Session handling to 403 if an
attempt is made to create a Checkout Session using an archived Offer.
2021-10-13 11:23:05 +02:00
Fabien O'Carroll
a441825c3f Passed MembersAPI the OffersAPI over OfferRepository
no-issue

The MembersAPI using the OfferRepository coupled it to the internals of
the Offers Module - instead we pass the "external" API - so that we can
change the internals, and not have to update the MembersAPI's usage.
2021-10-13 11:17:32 +02:00
Naz
dbdf7160bf Simplified DynamicRedirectManager's constructor
refs https://linear.app/tryghost/issue/CORE-84/have-a-look-at-the-eggs-redirects-refactor-branch

- This simplification allows to make the test for dependent services a lot more readable without a need to stub urlUtils
2021-10-13 10:04:55 +02:00
Fabien O'Carroll
b1914758b8 Added support for filter Offers by status
refs https://github.com/TryGhost/Team/issues/1131

This will allow Ghost Admin to display separate lists of active and
archived Offers! We must pass the options through so that the
OffersService is able to handle the filter passed in the request.
2021-10-12 18:39:25 +02:00
Thibaut Patel
836b5b4a0e Added a gscan check to make sure the match helper on custom settings of type select is used against specified options
refs 056928f7b9
refs https://github.com/TryGhost/Team/issues/1105
2021-10-12 18:35:02 +02:00
Fabien O'Carroll
dc3dad4524 Added initial support for Offer status
refs https://github.com/TryGhost/Team/issues/1131

This updates the Offers Service to include the `status` of an Offer,
which will be either 'active' or 'archived'. It also allows setting the
`status` of an Offer to one of these two values when adding & editing
Offers.
2021-10-12 17:15:26 +02:00
Sam Lord
a535cfdf16 Added metric-shipping to monitor boot-time
no issue
Boot-time metrics are really valuable for understanding how releases affect the performance of Ghost. The new @tryghost/metrics package lets us ship these metrics to different sources using the same configuration framework as @tryghost/logging introduced.
2021-10-12 15:01:50 +01:00
Thibaut Patel
f8b19f286a Added gscan checks for custom themes settings
refs https://github.com/TryGhost/Team/issues/1105

- checks package.json for the config.custom object shape
- checks for unknown custom theme settings
2021-10-12 14:52:50 +02:00
Renovate Bot
c5459db52e
Update dependency keypair to v1.0.4 2021-10-11 21:11:01 +00:00
Naz
421c71d4db Added debug output to the email analytics jobs
closes https://linear.app/tryghost/issue/CORE-91/add-email-analytics-job-unstalling-mechanism

- Additional debug stagements should give better visibility into what's going on with the internal services fetching email events.
- To see all email analytics related outputs use following DEBUG value:

DEBUG=@tryghost/email-analytics-provider-mailgun:email-analytics*
2021-10-11 19:11:23 +02:00
Renovate Bot
6dcad04dcc Update dependency @lodder/grunt-postcss to v3.1.0 2021-10-11 14:31:54 +02:00
Renovate Bot
361184fc1c
Update metascraper to v5.24.9 2021-10-11 09:05:09 +00:00
Kevin Ansfield
c33b596e9c
Added API tests for custom theme settings (#13519)
refs https://github.com/TryGhost/Team/issues/1104

- bumped `@tryghost/custom-theme-settings-service` so it throws a more appropriate `ValidationError` when setting keys don't exist or a select value is not known
- changed the custom theme settings service to have a `.init()` method which creates an instance of the service under `.api` so that we're able to create the instance at a particular point in the boot process when we know the models have been initialised
  - there were problems in tests because the service was being initialised through the require chain before models were initialised through the boot process
- fixed incorrect `camelCase` of resource name in API responses
2021-10-08 16:18:49 +01:00
Daniel Lockyer
7ad6dec0e0 v4.18.0 2021-10-08 16:00:26 +01:00
Daniel Lockyer
a6833077a7 Optimized database integrity check
refs 838fe54628

- see referenced commit for majority of context but in short,
  knex-migrator was doing a DB query per migration folder
- in Ghost, we currently have 79 folders, which results in 79
  queries during boot... owch
- the bump to knex-migrator in this commit uses a smarter method of
  grouping together the DB entries in 1 query, resulting in a drop of 79
  queries -> 1 query
2021-10-08 15:06:46 +01:00
Fabien O'Carroll
d9bcd4ec82 Fixed Stripe Checkout for Offers with monthly Cadence
no-issue

We were incorrectly checking the Offer Cadence and sending Members to
the yearly checkout.
2021-10-08 15:22:51 +02:00
Fabien O'Carroll
955621fa21 Removed requirement for Offer description field
refs https://github.com/TryGhost/Team/issues/1083

This field is not required but was previously causing API errors when
missing, the bump to members-offers removes this requirement.
2021-10-08 12:44:14 +02:00
Fabien O'Carroll
999cff35cf Supported repeating Offers for monthly Cadence
refs https://github.com/TryGhost/Team/issues/1083

Offers with a "repeating" duration will repeat for a number of months.
These offers are restricted to the monthly Cadence. This updates the
members-offers module to add support for them.
2021-10-08 12:15:11 +02:00
Fabien O'Carroll
817b2a3b0b Fixed Offers not sending back currency
refs https://github.com/TryGhost/Team/issues/1083

Offers should send back their currency when they are for a fixed amount
- this was missing that.
2021-10-08 11:43:40 +02:00
Renovate Bot
ff62a07142 Update dependency passport to v0.5.0 2021-10-08 10:32:41 +01:00
Renovate Bot
d9e426df0e Update dependency c8 to v7.10.0 2021-10-08 10:29:55 +01:00
renovate[bot]
47ffefe93e
Update dependency @tryghost/custom-theme-settings-service to v0.1.0 (#13512)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-10-07 23:07:20 +01:00
Fabien O'Carroll
15466b33ee Fixed durations for coupons created for Offers
refs https://github.com/TryGhost/Team/issues/1083

Previously we were not forwarding the Offer duration to Stripe.
2021-10-07 19:03:05 +02:00
renovate[bot]
ab9fc8e848
Supported fixed-amount & forever Offers
refs https://github.com/TryGhost/Team/issues/1083

The @tryghost/members-offers package has been updated to add support for 
more Offer durations and types

Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-10-07 18:57:54 +02:00
Renovate Bot
7555020a49 Pin dependency @tryghost/express-dynamic-redirects to 0.1.0 2021-10-07 16:52:23 +01:00
renovate[bot]
f8dd0b3d56
Ensured Offer codes are slugified
refs https://github.com/TryGhost/Team/issues/1083

As Offer codes are used in redirects we must ensure they're URL safe
2021-10-07 16:10:46 +02:00
Naz
10a24393d0 🐛 Fixed alert notifications being sent out to non-active users
refs https://linear.app/tryghost/issue/CORE-63/restrict-update-service-notifications-to-active-admins

- It only makes sense to notify active users about a notification of 'alert' or any other type really.
2021-10-06 22:34:25 +02:00
Renovate Bot
f3efd9834a
Update dependency @sentry/node to v6.13.3 2021-10-06 17:34:22 +00:00
Fabien O'Carroll
6220406716 Added support for Offers with Stripe Checkout
refs https://github.com/TryGhost/Team/issues/1090

This updates the Members & Offers modules to provide support for using
Offers in Stripe Checkout.

Members module now needs a handle to the Offers module repository, and
as such we have had to reorder the services boot order.
2021-10-06 17:24:39 +02:00
Hannah Wolfe
726db1c0ec
Added integration test config & moved db-driven tests
- some tests are necessarily driven from the db
- these are like unit tests, except they only make sense if using the db - else you have to stub too much to make them worthwhile
- for these rare but important cases, we have the clear concept of integration tests
2021-10-06 13:51:24 +01:00
Hannah Wolfe
624414e0c1
Moved server e2e tests to own folder
- We have a bunch of important server-related e2e tests
- Make these clear in their own folder
- "server" is everything that isn't the api or the frontend - kind of a catch-all concept
2021-10-06 12:55:37 +01:00
Hannah Wolfe
1dec3d56b1
Renamed our acceptance tests to "e2e"
- These are end-to-end tests, make it clearer what they are and what they are supposed to do
2021-10-06 12:40:52 +01:00
Fabien O'Carroll
3742a4afb7 Added Offers service
refs https://github.com/TryGhost/Team/issues/1083

This adds the Offers service which will allow us to build out an Admin
API to communicate with it. As well as wiring up the redirects to the
site app.
2021-10-06 12:33:19 +02:00
Renovate Bot
4f406318a9 Update dependency coffeescript to v2.6.1 2021-10-05 09:29:46 +01:00
Renovate Bot
9e7a789575 Update dependency postcss to v8.3.9 2021-10-05 08:35:08 +01:00
Daniel Lockyer
0ec6b425ee
Merged v4.17.1 into main
v4.17.1
2021-10-05 08:33:42 +01:00
Daniel Lockyer
a145c7b1b8 v4.17.1 2021-10-05 08:31:40 +01:00
Fabien O'Carroll
cda041d424 Moved StripeAPIService to its own service
refs https://github.com/TryGhost/Team/issues/1083

The Offers service is going to need access to the StripeAPIService too,
so we need to move it out of the @tryghost/members-api module and make
it accessible to both.
2021-10-04 19:28:19 +02:00
Renovate Bot
2acbf9fb50 Update dependency @tryghost/zip to v1.1.17 2021-10-04 16:40:06 +01:00
Renovate Bot
ada99d3e9d Update dependency @tryghost/package-json to v1.0.5 2021-10-04 16:12:35 +01:00
Renovate Bot
7941bfcafa Update dependency @tryghost/vhost-middleware to v1.0.18 2021-10-04 16:10:38 +01:00
Renovate Bot
d6347d80b3 Update dependency @tryghost/security to v0.2.12 2021-10-04 16:10:26 +01:00
Renovate Bot
18a6f536a1 Update dependency @tryghost/job-manager to v0.8.10 2021-10-04 16:08:02 +01:00
Renovate Bot
e24adb436b Update dependency @tryghost/session-service to v0.1.27 2021-10-04 16:05:54 +01:00
Renovate Bot
da0d97449f Update dependency @tryghost/promise to v0.1.12 2021-10-04 16:05:40 +01:00
Renovate Bot
e657527fa8 Update dependency @tryghost/mw-session-from-token to v0.1.25 2021-10-04 16:03:58 +01:00
Renovate Bot
682bb1cb1e Update dependency @tryghost/limit-service to v0.6.4 2021-10-04 16:03:40 +01:00
Renovate Bot
79f778c469 Update dependency @tryghost/errors to v0.2.16 2021-10-04 16:03:27 +01:00
Renovate Bot
9412515e98 Update dependency @tryghost/image-transform to v1.0.16 2021-10-04 16:00:43 +01:00
Renovate Bot
55f951f58f Update dependency @tryghost/constants to v0.1.11 2021-10-04 16:00:34 +01:00
Renovate Bot
ed069d51d3 Update dependency @tryghost/bootstrap-socket to v0.2.12 2021-10-04 16:00:27 +01:00
Renovate Bot
e53bafb1aa Update dependency @tryghost/adapter-manager to v0.2.17 2021-10-04 16:00:18 +01:00
Kevin Ansfield
28fb6f2939 Fixed errors when syncing theme settings
no issue

- bumped `@tryghost/custom-theme-settings-service`
- fixes errors when a previously seen theme setting has been removed from the theme when syncing
- fixes settings for non-active theme being deleted/updated instead of just settings for the current theme
2021-10-04 12:17:41 +01:00
Renovate Bot
c2ea67b2ff
Update metascraper to v5.24.8 2021-10-04 00:23:21 +00:00
Daniel Lockyer
e0f6d59046 v4.17.0 2021-10-01 16:00:30 +01:00
Fabien O'Carroll
ea42fac527 Charged payment for Subscription upgrades immediately
refs https://github.com/TryGhost/Team/issues/1075

This includes changes to how we handle upgrading subscriptions to ensure
that members are immediately charged for upgrades. This fixes a flaw
where upgrading would not be charged until the end of the current
billing cycle, essentially giving free upgraded access for a period of
time.
2021-10-01 13:22:19 +02:00
Renovate Bot
ef20a564a1 Update dependency @tryghost/email-analytics-provider-mailgun to v1.0.2 2021-10-01 11:25:19 +01:00
Renovate Bot
64124b9cea Update dependency @tryghost/email-analytics-service to v1.0.2 2021-10-01 10:48:19 +01:00
Renovate Bot
dedfebfdca Update dependency @tryghost/constants to v0.1.10 2021-10-01 10:19:16 +01:00
Renovate Bot
12451d413d Update dependency @tryghost/errors to v0.2.15 2021-10-01 09:54:05 +01:00
Renovate Bot
795cf55c11 Update dependency @tryghost/image-transform to v1.0.15 2021-10-01 09:53:58 +01:00
Renovate Bot
e28b87c836 Update dependency @tryghost/package-json to v1.0.4 2021-10-01 09:53:49 +01:00
Renovate Bot
1e749d78d8 Update dependency @tryghost/session-service to v0.1.26 2021-10-01 09:53:43 +01:00
Renovate Bot
47a582b51c Update dependency @tryghost/vhost-middleware to v1.0.17 2021-10-01 09:53:23 +01:00
Renovate Bot
55ee3ea1c6 Update dependency @tryghost/mw-session-from-token to v0.1.24 2021-10-01 08:41:24 +01:00
Renovate Bot
7be5e861c7 Update dependency @tryghost/security to v0.2.11 2021-10-01 08:41:01 +01:00
Renovate Bot
612a202525 Update dependency @tryghost/promise to v0.1.11 2021-10-01 08:40:52 +01:00
Renovate Bot
4ac27cd889 Update dependency @tryghost/bootstrap-socket to v0.2.11 2021-10-01 08:40:14 +01:00
Renovate Bot
a98b1e8541 Update dependency @tryghost/adapter-manager to v0.2.16 2021-10-01 08:40:09 +01:00
Renovate Bot
99fdfe8ec8 Update dependency @tryghost/config-url-helpers to v0.1.2 2021-10-01 08:40:01 +01:00
Renovate Bot
568dfc7d34 Update dependency @tryghost/tpl to v0.1.5 2021-10-01 08:39:16 +01:00
Renovate Bot
656237a7cf Update dependency @tryghost/zip to v1.1.16 2021-10-01 08:39:07 +01:00
Renovate Bot
07a7c0ea4c Update dependency @tryghost/limit-service to v0.6.3 2021-10-01 08:38:51 +01:00
Renovate Bot
9642635ca9 Update dependency @tryghost/job-manager to v0.8.9 2021-10-01 08:38:40 +01:00
renovate[bot]
1b6253e140
Update dependency @tryghost/members-importer to v0.3.3 (#13372)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-09-29 10:58:10 +02:00
Kevin Ansfield
59adb9a9cb Added route for updating custom theme settings
refs https://github.com/TryGhost/Team/issues/1070

- bumped `@tryghost/custom-theme-settings-service` for access to `.updateSettings()`
- added `PUT /custom_theme_settings` route that delegates to `customThemeSettingsService.updateSettings()` to perform the db and cache updates
- invalidates the cache in Ghost because a theme setting change will mean the front-end output will change
2021-09-28 16:09:39 +01:00
Daniel Lockyer
1e5f28727d
🐛 Fixed mail config not respecting disabled secure connections
refs https://forum.ghost.org/t/un-noticed-email-config-change-in-4-15-16/25869/6
refs https://linear.app/tryghost/issue/CORE-66/fixed-secureconnection-alias-for-nodemailer

- `secureConnection` was removed in Nodemailer 1.0.2 in favor of
  `secure` but we're locked into supporting it because a lot of
  our users will have it in their config
- I attempted to alias it to keep compatibility but I did this
  incorrectly and only handled the cases where it was set to `true`
- this meant users who had disabled secure connections were seeing SSL
  warnings because the library was trying to connect via SSL to a
  non-SSL endpoint
- the aliasing is fixed in `@tryghost/nodemailer` 0.3.3 and so this
  commit bumps the package in Ghost
2021-09-28 15:19:36 +01:00
renovate[bot]
9797787c4b
Update dependency @tryghost/magic-link to v1.0.13 (#13370)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-09-28 16:09:07 +02:00
renovate[bot]
135bb6a4a4
Update dependency @tryghost/members-csv to v1.1.7 (#13371)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-09-28 16:08:50 +02:00
renovate[bot]
7044fd459e
Update dependency @tryghost/members-ssr to v1.0.14 (#13373)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-09-28 15:44:06 +02:00
Fabien O'Carroll
b22050c037 Added initial support for Offers 1-day version
refs https://github.com/TryGhost/Team/issues/1090

This updates the members-api to allow passing an Offer ID when creating
a Stripe Checkout Session. This will be used for the 1-day version of
Offers.
2021-09-28 15:10:27 +02:00
Renovate Bot
328a88087b
Update metascraper to v5.24.7 2021-09-27 21:15:26 +00:00
Renovate Bot
85c46b4eda Update dependency postcss to v8.3.8 2021-09-27 13:00:59 +01:00
Kevin Ansfield
2947db0e6b
Added API endpoint for browsing custom theme settings (#13362)
refs https://github.com/TryGhost/Team/issues/1070

- bumped `@tryghost/custom-theme-settings-service` to get access to `.listSettings()` method
- added GET `/api/canary/admin/theme_settings/` route behind `'customThemeSettings'` feature flag that uses the custom theme settings service to return settings resources that are a combination of the theme-provided definition and the saved value
2021-09-27 11:31:47 +01:00