0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00
ghost/test/unit
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
..
adapters Removed unused onMany method from events 2021-05-04 13:28:24 +01:00
api Added support for gating content by member labels and products (#12946) 2021-05-10 19:32:11 +01:00
apps Moved active theme to new theme engine service 2021-04-23 15:28:50 +01:00
data Fixed settings integrity spec 2021-05-10 18:54:47 +05:30
helpers Improved i18n to use DI for logging + config 2021-05-06 10:58:24 +01:00
lib Extracted package-json lib to Utils 2021-05-07 12:35:06 +01:00
models Expanded requires of lib/common i18n and events 2021-05-03 17:14:52 +01:00
server Expanded requires of lib/common i18n and events 2021-05-03 17:14:52 +01:00
services Updated theme middleware to use products api 2021-05-07 16:32:57 +01:00
shared Added fake logging to i18n tests 2021-05-06 19:38:01 +01:00
web Fixed broken require path (bridge in tests) 2021-04-26 15:01:10 +01:00