0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00
ghost/core/server/models
Simon Backx 6b3a657f88
Renamed newsletter_id and email_recipient_filter options (#14798)
refs https://github.com/TryGhost/Team/issues/1596

- Renamed `newsletter_id` to `newsletter` option, the `newsletter` option expects a slug instead of an id
- Renamed `email_recipient_filter` to `email_segment` option
- Default `email_segment` to `all`. Ignored if no newsletter is set
- `email_segment` is ignored if no newsletter is set
- When reverting a post to a draft, both `newsletter` and `email_segment` are reset to their default values (null, all)
- Removed legacy mapping from old email_recipient_filter values 'paid' and 'free' (already a migration in place)
- Dropped legacy throwing errors when email_recipient_filter is paid or free in transformEmailRecipientFilter
- Reorganized transformEmailRecipientFilter parameters for the now required newsletter parameter
- Fixed an issue where the newsletter filter wasn't working because it wasn't in permittedoptions
- Fixed an issue where you could send to an archived newsletter
- Added an extra protection when scheduling to an active, and later archiving the newsletter
- Dropped support for `send_email_when_published` in API
- When importing posts we currently don't have a system in place to set the newsletter_id to map the `send_email_when_published` behaviour. Since this was already the case, I won't include a fix in this PR.
- Stripped `email_recipient_filter`/`email_segment` from Content API (https://ghost.slack.com/archives/C02G9E68C/p1652363211841359?thread_ts=1650623650.233229&cid=C02G9E68C)
- Updated `admin-api-schema` to 3.2.0, which includes the new email_segment property
- Contains a temporary fix for https://github.com/TryGhost/Team/issues/1626, where the `.related('newsletter').fetch` call fails when the newsletter relation is already loaded, because of the overridden `formatOnWrite` method.

Since the `email_recipient_filter` is no longer used without a newsletter, the `none` value is no longer used. A migration transforms all those values to `all`. This should be safe, because we only send an email now when newsletter_id is not null (scheduled posts should already have a newsletter_id, even if at the time of scheduling they didn't add the newsletter_id option, because at that time, we defaulted to the default newsletter).

Admin changes to make this work: https://github.com/TryGhost/Admin/pull/2380
2022-05-16 10:18:04 +02:00
..
base replaced deprecated String.prototype.substr() (#14367) 2022-04-28 11:49:12 +01:00
relations Removed permissions handling of "author_id" 2022-05-09 20:34:06 +08:00
action.js
api-key.js Update dependency @tryghost/security to v0.3.0 (#14718) 2022-05-06 17:53:10 +01:00
author.js
benefit.js
custom-theme-setting.js
email-batch.js
email-recipient.js
email.js Filtered member email recipients based on the newsletter subscriptions (#14489) 2022-04-26 12:31:34 +01:00
index.js
integration.js Added frontend key to ghost_head for portal (#14782) 2022-05-11 17:34:31 +01:00
invite.js
label.js Replaced white/black list terminology 2022-04-19 11:19:59 +01:00
member-analytic-event.js
member-cancel-event.js Added the MemberCancelEvent model 2022-03-11 21:50:06 +01:00
member-email-change-event.js Added linting for use of @tryghost/errors 2021-12-01 11:22:21 +00:00
member-login-event.js Added linting for use of @tryghost/errors 2021-12-01 11:22:21 +00:00
member-paid-subscription-event.js Added linting for use of @tryghost/errors 2021-12-01 11:22:21 +00:00
member-payment-event.js Added linting for use of @tryghost/errors 2021-12-01 11:22:21 +00:00
member-product-event.js Added linting for use of @tryghost/errors 2021-12-01 11:22:21 +00:00
member-status-event.js Added linting for use of @tryghost/errors 2021-12-01 11:22:21 +00:00
member-stripe-customer.js
member-subscribe-event.js Added newsletter relation to subscribe events (#14585) 2022-04-27 16:44:27 +02:00
member.js Dropped subscribed column in members table 2022-05-09 16:47:43 +01:00
mobiledoc-revision.js
newsletter.js Renamed newsletter_id and email_recipient_filter options (#14798) 2022-05-16 10:18:04 +02:00
offer-redemption.js
offer.js
permission.js
post.js Renamed newsletter_id and email_recipient_filter options (#14798) 2022-05-16 10:18:04 +02:00
posts-meta.js
product.js Switched products.visible for products.visibility (#14264) 2022-03-04 11:07:38 +00:00
role.js Replaced white/black list terminology 2022-04-19 11:19:59 +01:00
session.js
settings.js Renamed lang and session_secret default settings (#14791) 2022-05-12 15:07:05 +01:00
single-use-token.js Updated SingleUseToken grace period to 10 minutes (#13926) 2022-01-03 17:55:53 +02:00
snippet.js
stripe-customer-subscription.js Added mrr column to subscriptions (#14448) 2022-04-12 11:02:18 +02:00
stripe-price.js
stripe-product.js
tag-public.js
tag.js Replaced white/black list terminology 2022-04-19 11:19:59 +01:00
user.js Replaced white/black list terminology 2022-04-19 11:19:59 +01:00
webhook.js Changed webhooks to store safe version 2022-05-06 12:43:14 +01:00