Skip to content

Commit

Permalink
Fixed tiers paywall selecting all paid tiers (#19817)
Browse files Browse the repository at this point in the history
refs INC-36

- oversight in parent commit 00cff0a
  • Loading branch information
sagzy committed Mar 6, 2024
1 parent 69466ec commit ae95e8d
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit ae95e8d

Please sign in to comment.