0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Fixed tiers paywall selecting all paid tiers (#19817)

refs INC-36

- oversight in parent commit 00cff0a
This commit is contained in:
Sag 2024-03-06 22:14:17 +01:00 committed by GitHub
parent 00cff0aece
commit 656846018a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -62,10 +62,14 @@ module.exports = async (model, frame, options = {}) => {
jsonModel.tiers = tiersData || [];
}
if (['tiers', 'paid'].includes(jsonModel.visibility) && jsonModel.tiers) {
if (jsonModel.visibility === 'paid' && jsonModel.tiers) {
jsonModel.tiers = tiersData ? tiersData.filter(t => t.type === 'paid') : [];
}
if (jsonModel.visibility === 'tiers' && Array.isArray(jsonModel.tiers)) {
jsonModel.tiers = jsonModel.tiers.filter(t => t.type === 'paid');
}
if (!['members', 'public', 'paid', 'tiers'].includes(jsonModel.visibility)) {
const tiers = await postsService.getProductsFromVisibilityFilter(jsonModel.visibility);