From bd3125873bccb96ae11a95d3c6abc8a20bc09cc6 Mon Sep 17 00:00:00 2001 From: Sag Date: Wed, 6 Mar 2024 21:30:00 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixed=20free=20tier=20showing=20?= =?UTF-8?q?in=20the=20tiers-only=20paywall=20in=20posts=20(#19807)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refs INC-36 fixes https://github.com/TryGhost/Ghost/issues/19796 - The tiers-only paywall was incorrectly rendering "Free". Example: "This post is for subscribers of the Free, Silver and Gold tiers only" - Steps to reproduce the issue: 1. Create a post with public visibility, publish it 2. Then swap the visibility to specific tiers. The default selects all paid tiers. Leave it like that 3. Update the post. The paywall show Free, even though it should be showing only the paid tiers - This fix filters out the "free" tier when visibility is set to tiers, before updating a Post or a Page. The fix includes bulk updates from the list of Posts and Pages (right-click on a Post/Page > Change Access). --- .../api/endpoints/utils/serializers/output/mappers/posts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 6ab36cd8f089..8e066799f024 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,7 +62,7 @@ module.exports = async (model, frame, options = {}) => { jsonModel.tiers = tiersData || []; } - if (jsonModel.visibility === 'paid' && jsonModel.tiers) { + if (['tiers', 'paid'].includes(jsonModel.visibility) && jsonModel.tiers) { jsonModel.tiers = tiersData ? tiersData.filter(t => t.type === 'paid') : []; }