From 1e988cccff93f3b116473a0c95c51fdfa4639e7e Mon Sep 17 00:00:00 2001 From: Sag Date: Sat, 27 Jan 2024 01:46:59 +0100 Subject: [PATCH] Revert Portal changes (#19594) no issue - This revert recent changes made to Portal, that may be causing the Free tier to not render properly on Ghost sites --- .../settings/advanced/labs/AlphaFeatures.tsx | 8 ++++++++ apps/portal/src/utils/helpers.js | 10 ++++++---- ghost/core/core/shared/labs.js | 7 ++++--- .../e2e-api/admin/__snapshots__/settings.test.js.snap | 2 +- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/apps/admin-x-settings/src/components/settings/advanced/labs/AlphaFeatures.tsx b/apps/admin-x-settings/src/components/settings/advanced/labs/AlphaFeatures.tsx index 83094324d2..bc6d49a6b9 100644 --- a/apps/admin-x-settings/src/components/settings/advanced/labs/AlphaFeatures.tsx +++ b/apps/admin-x-settings/src/components/settings/advanced/labs/AlphaFeatures.tsx @@ -47,6 +47,10 @@ const features = [{ title: 'Tips & donations', description: 'Enables publishers to collect one-time payments', flag: 'tipsAndDonations' +},{ + title: 'Filter by email disabled', + description: 'Allows filtering members by email disabled', + flag: 'filterEmailDisabled' },{ title: 'AdminX Demo', description: 'Adds a navigation link to the AdminX demo app', @@ -55,6 +59,10 @@ const features = [{ title: 'New email addresses', description: 'For self hosters, forces the usage of the mail.from config as from address for all outgoing emails', flag: 'newEmailAddresses' +},{ + title: 'Portal improvements', + description: 'Adds a bunch of improvements to portal and portal settings', + flag: 'portalImprovements' }]; const AlphaFeatures: React.FC = () => { diff --git a/apps/portal/src/utils/helpers.js b/apps/portal/src/utils/helpers.js index 0b45f80893..eaaffa2a18 100644 --- a/apps/portal/src/utils/helpers.js +++ b/apps/portal/src/utils/helpers.js @@ -431,8 +431,7 @@ export function getSiteProducts({site, pageQuery}) { } if (hasFreeProductPrice({site})) { products.unshift({ - id: 'free', - type: 'free' + id: 'free' }); } return products; @@ -451,8 +450,11 @@ export function getFreeProductBenefits({site}) { } export function getFreeTierTitle({site}) { - const freeProduct = getFreeProduct({site}); - return freeProduct?.name || 'Free'; + if (hasOnlyFreeProduct({site})) { + return 'Free membership'; + } else { + return 'Free'; + } } export function getFreeTierDescription({site}) { diff --git a/ghost/core/core/shared/labs.js b/ghost/core/core/shared/labs.js index f3bcfc6c12..4e3c4e601c 100644 --- a/ghost/core/core/shared/labs.js +++ b/ghost/core/core/shared/labs.js @@ -22,8 +22,7 @@ const GA_FEATURES = [ 'signupForm', 'recommendations', 'listUnsubscribeHeader', - 'filterEmailDisabled', - 'portalImprovements' + 'filterEmailDisabled' ]; // NOTE: this allowlist is meant to be used to filter out any unexpected @@ -46,8 +45,10 @@ const ALPHA_FEATURES = [ 'importMemberTier', 'lexicalIndicators', // 'adminXOffers', + 'filterEmailDisabled', 'adminXDemo', - 'newEmailAddresses' + 'newEmailAddresses', + 'portalImprovements' ]; module.exports.GA_KEYS = [...GA_FEATURES]; diff --git a/ghost/core/test/e2e-api/admin/__snapshots__/settings.test.js.snap b/ghost/core/test/e2e-api/admin/__snapshots__/settings.test.js.snap index 1ba2068f4b..f2a1765062 100644 --- a/ghost/core/test/e2e-api/admin/__snapshots__/settings.test.js.snap +++ b/ghost/core/test/e2e-api/admin/__snapshots__/settings.test.js.snap @@ -1155,7 +1155,7 @@ exports[`Settings API Edit Can edit a setting 2: [headers] 1`] = ` Object { "access-control-allow-origin": "http://127.0.0.1:2369", "cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0", - "content-length": "4535", + "content-length": "4507", "content-type": "application/json; charset=utf-8", "content-version": StringMatching /v\\\\d\\+\\\\\\.\\\\d\\+/, "etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,