mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -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:
parent
d461525978
commit
b259bb2431
1 changed files with 6 additions and 1 deletions
|
@ -40,7 +40,12 @@ function checkPostAccess(post, member) {
|
||||||
return PERMIT_ACCESS;
|
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)) {
|
if (visibility && member.status && nql(visibility, {expansions: MEMBER_NQL_EXPANSIONS}).queryJSON(member)) {
|
||||||
return PERMIT_ACCESS;
|
return PERMIT_ACCESS;
|
||||||
|
|
Loading…
Add table
Reference in a new issue