diff --git a/ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/posts.js b/ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/posts.js index cef1588d643..6ab36cd8f08 100644 --- a/ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/posts.js +++ b/ghost/core/core/server/api/endpoints/utils/serializers/output/mappers/posts.js @@ -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);