mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 14:03:48 +03:00
🐛 Fixed post content gating error for themes using old api
refs https://github.com/TryGhost/Team/issues/1071 We switched to using tiers pivot table that stores list of tiers with access to post when visibility is set to `tiers`. For themes using v3 API while having posts restricted to specific tiers visibility, the post data will not include the list of tiers, which caused an unexpected error while trying to determine post access from tiers list. This change blocks access to post if specific tiers visibility is enabled without data available for list of tiers on post.
This commit is contained in:
parent
c80e68b93a
commit
3ccd3601b3
@ -42,6 +42,9 @@ function checkPostAccess(post, member) {
|
||||
|
||||
let visibility = post.visibility === 'paid' ? 'status:-free' : post.visibility;
|
||||
if (visibility === 'tiers') {
|
||||
if (!post.tiers) {
|
||||
return BLOCK_ACCESS;
|
||||
}
|
||||
visibility = post.tiers.map((product) => {
|
||||
return `product:${product.slug}`;
|
||||
}).join(',');
|
||||
|
Loading…
Reference in New Issue
Block a user