0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Updated content gating to use new tiers visibility

refs https://github.com/TryGhost/Team/issues/1071

- `tiers` are now attached as a list on post with restricted tiers access
This commit is contained in:
Rishabh 2022-01-26 16:53:56 +05:30 committed by Rishabh Garg
parent d461525978
commit b259bb2431

View file

@ -40,7 +40,12 @@ function checkPostAccess(post, member) {
return PERMIT_ACCESS;
}
const visibility = post.visibility === 'paid' ? 'status:-free' : post.visibility;
let visibility = post.visibility === 'paid' ? 'status:-free' : post.visibility;
if (visibility === 'tiers') {
visibility = post.tiers.map((product) => {
return `product:${product.slug}`;
}).join(',');
}
if (visibility && member.status && nql(visibility, {expansions: MEMBER_NQL_EXPANSIONS}).queryJSON(member)) {
return PERMIT_ACCESS;