Commit Graph

14497 Commits

Author SHA1 Message Date
Fabien O'Carroll
f3bb6b43a5 Added Offers feature to Ghost
refs https://github.com/TryGhost/Team/issues/1115

This allows users to create Offers for Tier/Cadence pairs in order to
provide discounted subscriptions to Members! We have support for
percentage based discounts & fixed price discounts, either for the first
payment, all payments, or a number of monthly payments.

Offers also have a code, which can be used as an easy way to share them,
as visiting https://site.com/offer-code will automatically open Portal
with the Offer prepopulated.
2021-10-22 17:55:34 +02: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
Fabien O'Carroll
696d8e3c49 Added 404 handling for edit Offer
no-issue

This was also missing as part of the Offers API.
2021-10-22 16:16:39 +02:00
Kevin Ansfield
a6982d5606
Added ability for themes to define custom settings (#13661)
closes https://github.com/TryGhost/Team/issues/1164

Themes can now define custom settings via their `package.json` file, and use them in templates via `@custom.{setting}`. Values for custom settings can be changed by site owners through a redesigned "Design settings" area in the admin interface.

Full announcement, documentation, and examples will be made available soon.

Co-authored-by:
- Sanne de Vries (@sanne-san)
- Thibaut Patel (@tpatel)
2021-10-22 15:02:16 +01: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
Kevin Ansfield
0c6cd37679 Fixed missing space between authors in emails
no issue

- author line was appearing as "Author One,Author Two,..." with no space
- fixed the generation of `post.authors` when serializing a post before it's rendered for email
2021-10-22 14:41:15 +01:00
Renovate Bot
0e4be5a390 Update dependency @tryghost/job-manager to v0.8.11 2021-10-22 15:39:15 +02:00
Daniel Lockyer
e834904125
Fixed verification threshold when set to 0
no issue

- if the verification threshold is 0, `_.get(..)` becomes falsy so we
  fallback to Infinity
- this is not correct - we only want to default to Infinity if the value
  is not set
- this commit explicitly compares the config value to `undefined` and sets
  the fallback accordingly
2021-10-22 15:33:59 +02:00
Kevin Ansfield
d7fbf94d91
Fixed ETag header for admin templates not changing between versions (#13680)
refs https://github.com/TryGhost/Team/issues/1175

We found the ETag header sent when serving the Admin template for /ghost/ was not changing between versions which after an upgrade could result in out of date cached content being served containing links to JS/CSS files that no longer existed.

The culprit is weak etags served by Node's `send` package, coupled with Admin template filesize not changing between versions and `npm pack` setting a fixed modification date for every file. See https://github.com/pillarjs/send/issues/176 for more details.

- updated the Admin app's controller to read the template and generate an md5 hash of the contents so we can serve a strong ETag header value when serving the `/ghost/` html
2021-10-22 14:25:58 +01: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
363eb94aee Handled 404 for Offer not found
no-issue

This was missing handling! We need to throw a NotFoundError so we
return with the correct response.
2021-10-22 14:22:33 +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
Fabien 'egg' O'Carroll
d962f0e18e
Removed NOT NULL constraint from portal_title (#13659)
refs https://github.com/TryGhost/Team/issues/1163

We want to make the title for Offers optional, our nullable validation
means that we cannot store an empty string, so we must remove the NOT
NULL constraint from the column if we want to store either an empty
value or null.

There is a bug with editing columns in SQLite with `knex` which strips all
the indexes, so we have to manually add them afterwards.
2021-10-22 14:14:49 +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
Daniel Lockyer
ed6a8dca76 Inlined package requires to save boot time and memory
no issue

- following on from f4fb0fcbaa,
  this commit moves around some package requires in Ghost
- these are often niche packages that do something in a subsystem of
  Ghost, and are not necessarily be needed to boot the application
- these packages use non-negligible CPU and memory when they are
  required, so it makes sense to lazy-require them
- the concern here is that we obscure the code too much by moving
  random requires further into code, but the changes are small and the
  improvements big
- this commit bring the boot time since 4.19.0 down ~31% and initial
  memory usage down by a total of ~12%
2021-10-22 09:57:59 +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
Hannah Wolfe
df14789861
Enabled restricted require rule for core/server
- we're now so close to having the server not require anything from the frontend... so close
- having these last few problems be visible is motivating
- should be able to upgrade it to an error soooon!
2021-10-21 20:37:08 +01:00
Hannah Wolfe
2d0b5c872f
Renamed frontend/web/app to site
- This leaves us room to bring the frontend app in as app.js
2021-10-21 19:54:50 +01:00
Hannah Wolfe
faea2da596
Moved server/web/site to frontend/web
- we're slowly trying to draw the lines between the backend and the frontend correctly
- these files deal only with serving the frontend so they should live there
- there are lots of mixed requires in these files, so having them in the right place makes that clear
2021-10-21 19:28:18 +01:00
Fabien O'Carroll
8c9b4d18bf Fixed error when enabling Offers via labs
no-issue

The listOffers method requires an options object. This was missed during
the update.
2021-10-21 20:05:42 +02: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
Hannah Wolfe
2777093c76
Refactored model init to be implicit
- no more need to explictly add a model file to be loaded!
- this makes building Ghost just the tiniest smidge easier
2021-10-21 17:01:26 +01:00
Hannah Wolfe
99fde5154f
Fixed dependency on the order of models
- this has been a niggle for ages, we shouldn't need to care what order our models are loaded in
- this is stopping us from having a built-in model loader and "frameworkizing" models
2021-10-21 16:57:36 +01: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