Ghost/core/server/services
Kevin Ansfield 322664a145
Added ability to send a newsletter to members with a certain label or product (#12932)
refs https://github.com/TryGhost/Team/issues/581
refs https://github.com/TryGhost/Team/issues/582

When publishing a post via the API it was possible to send it using `?email_recipient_filter=all/free/paid` which allowed you to send to members only based on their payment status which is quite limiting for some sites.

This PR updates the `?email_recipient_filter` query param to support Ghost's `?filter` param syntax which enables more specific recipient lists, eg:

`?email_recipient_filter=status:free` = free members only
`?email_recipient_filter=status:paid` = paid members only
`?email_recipient_filter=label:vip` = members that have the `vip` label attached
`?email_recipient_filter=status:paid,label:vip` = paid members and members that have the `vip` label attached

The older `free/paid` values are still supported by the API for backwards compatibility.

- updates `Post` and `Email` models to transform legacy `free` and `paid` values to their NQL equivalents on read/write
  - lets us not worry about supporting legacy values elsewhere in the code
  - cleanup migration to transform all rows slated for 5.0
- removes schema and API `isIn` validations for recipient filters so allow free-form filters
- updates posts API input serializers to transform `free` and `paid` values in the `?email_recipient_filter` param to their NQL equivalents for backwards compatibility
- updates Post API controllers `edit` methods to run a query using the supplied filter to verify that it's valid
- updates `mega` service to use the filter directly when selecting recipients
2021-05-07 11:56:41 +01:00
..
adapter-manager Moved config from server to shared (#11850) 2020-05-27 18:47:53 +01:00
auth Moved i18n to shared 2021-05-04 13:03:38 +01:00
bulk-email Moved i18n to shared 2021-05-04 13:03:38 +01:00
email-analytics Fixed analytics require error 2021-03-02 08:26:42 +00:00
invitations Moved i18n to shared 2021-05-04 13:03:38 +01:00
invites Moved i18n to shared 2021-05-04 13:03:38 +01:00
jobs Added custom worker message handler 2021-02-22 20:02:00 +13:00
mail Fixed i18n being called outside of a function 2021-05-05 16:34:40 +01:00
mega Added ability to send a newsletter to members with a certain label or product (#12932) 2021-05-07 11:56:41 +01:00
members Updated products/prices data in member site settings 2021-05-07 15:15:10 +05:30
notifications Moved i18n to shared 2021-05-04 13:03:38 +01:00
permissions Moved i18n to shared 2021-05-04 13:03:38 +01:00
settings Expanded requires of lib/common i18n and events 2021-05-03 17:14:52 +01:00
themes Moved package-json wrapper outside implementation folder 2021-05-06 12:56:21 +01:00
webhooks Expanded requires of lib/common i18n and events 2021-05-03 17:14:52 +01:00
labs.js Moved i18n to shared 2021-05-04 13:03:38 +01:00
limits.js Fixed limits realoding during soft Ghost restart 2021-04-10 00:08:17 +12:00
oembed.js Moved the OEmbed service to use our DI pattern 2021-01-15 15:35:30 +01:00
slack.js Moved i18n to shared 2021-05-04 13:03:38 +01:00
users.js Moved the users service to use our DI pattern 2021-01-15 17:58:36 +01:00
xmlrpc.js Moved i18n to shared 2021-05-04 13:03:38 +01:00