Ghost/core/server/models
Kevin Ansfield c36e749820
Added support for gating content by member labels and products (#12946)
refs https://github.com/TryGhost/Team/issues/581
closes https://github.com/TryGhost/Team/issues/582

Emails can now be sent to members with specific associated labels or products by specifying an NQL string. We want to bring the same members segment feature to content by allowing `visibility` to be an NQL filter string on top of the `public/members/paid` special-case strings.

As an example it's possible to set `posts.visibility` to `label:vip` to make a post available only to those members with the `vip` label.

- removed enum validations for `visibility` so it now accepts any string or `null`
    - bumped `@tryghost/admin-api-schema` for API-level validation changes
- added nql validation to API input validators by running the visibility query against the members model
- added transform of NQL to special-case visibility values when saving post model
    - ensures there's a single way of representing "members" and "paid" where NQL gives multiple ways of representing the same segment
    - useful for keeping theme-level checks such as `{{#has visibility="paid"}}` working as expected
- updated content-gating to parse nql from post's visibility and use it to query the currently logged in member to see if there's a match
    - bumped @tryghost/members-api to include label and product data when loading member
2021-05-10 19:32:11 +01:00
..
base Moved i18n to shared 2021-05-04 13:03:38 +01:00
plugins Moved i18n to shared 2021-05-04 13:03:38 +01:00
relations Improved single author deprecated notices 2021-05-04 17:11:12 +01:00
action.js Added model implementation for actions 2019-02-06 21:36:09 +01:00
api-key.js Added the user_id field to the api_keys table 2020-11-20 09:53:18 +01:00
author.js Added plugin based author and public tag models in API v2 (#10284) 2019-01-03 20:30:35 +01:00
email-batch.js Fixed creation of EmailBatch and EmailRecipient collections 2020-10-14 15:11:45 +01:00
email-recipient.js Removed unnecessary bookshelf-relations config in EmailRecipient model 2021-01-05 15:28:30 +00:00
email.js Added ability to send a newsletter to members with a certain label or product (#12932) 2021-05-07 11:56:41 +01:00
index.js Added models for stripe prices and products 2021-04-12 21:53:59 +05:30
integration.js Updated host config to correctly use camelCase 2021-03-04 11:39:32 +00:00
invite.js Moved i18n to shared 2021-05-04 13:03:38 +01:00
label.js Moved i18n to shared 2021-05-04 13:03:38 +01:00
member-email-change-event.js Added member relation to events (#12656) 2021-02-16 16:14:20 +00:00
member-login-event.js Added member relation to events (#12656) 2021-02-16 16:14:20 +00:00
member-paid-subscription-event.js Added member relation to events (#12656) 2021-02-16 16:14:20 +00:00
member-payment-event.js Added member relation to events (#12656) 2021-02-16 16:14:20 +00:00
member-status-event.js Fixed member status events query 2021-02-18 18:11:50 +05:30
member-stripe-customer.js Added error handling for failed member imports 2020-08-26 17:11:35 +12:00
member-subscribe-event.js Added member relation to events (#12656) 2021-02-16 16:14:20 +00:00
member.js Added Product model and Member model relation (#12859) 2021-04-08 18:01:49 +01:00
mobiledoc-revision.js Added mobiledoc revisions functionality 2018-10-09 15:31:09 +02:00
permission.js Updated var declarations to const/let and no lists 2020-04-29 16:51:13 +01:00
post.js Added support for gating content by member labels and products (#12946) 2021-05-10 19:32:11 +01:00
posts-meta.js 🐛 Fixed performance regression introduced in 4.1.0 (#12807) 2021-03-23 09:11:24 +00:00
product.js Added Product, StripeProduct & StripePrice relations (#12877) 2021-04-14 19:20:39 +01:00
role.js Moved i18n to shared 2021-05-04 13:03:38 +01:00
session.js Removed user_id constraint when upserting session (#10085) 2018-10-30 16:15:48 +07:00
settings.js Moved i18n to shared 2021-05-04 13:03:38 +01:00
single-use-token.js 🐛 Added multiple use grace period to tokens (#12519) 2021-01-18 17:03:41 +00:00
snippet.js 🐛 Fixed performance regression introduced in 4.1.0 (#12807) 2021-03-23 09:11:24 +00:00
stripe-customer-subscription.js Updated price serialisation on subscription 2021-05-07 15:15:10 +05:30
stripe-price.js Added models for stripe prices and products 2021-04-12 21:53:59 +05:30
stripe-product.js Added Product, StripeProduct & StripePrice relations (#12877) 2021-04-14 19:20:39 +01:00
tag-public.js Added plugin based author and public tag models in API v2 (#10284) 2019-01-03 20:30:35 +01:00
tag.js Moved i18n to shared 2021-05-04 13:03:38 +01:00
user.js Moved i18n to shared 2021-05-04 13:03:38 +01:00
webhook.js Bumped webhook API defaults to v4 2021-03-02 12:31:52 +13:00