From 191a301242f156b671275ef63d3ce829e2f27e45 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Thu, 4 Jul 2024 17:21:48 +0100 Subject: [PATCH] Cleaned up hasPortalImprovements GA feature flag (#20548) no issue - the feature has been GA for a long time now so the conditionals are no longer required --- .../membership/portal/SignupOptions.tsx | 24 ++++++++----------- .../membership/tiers/TierDetailModal.tsx | 9 +++---- ghost/admin/app/services/feature.js | 1 - ghost/core/core/shared/labs.js | 1 - .../admin/__snapshots__/settings.test.js.snap | 2 +- 5 files changed, 14 insertions(+), 23 deletions(-) diff --git a/apps/admin-x-settings/src/components/settings/membership/portal/SignupOptions.tsx b/apps/admin-x-settings/src/components/settings/membership/portal/SignupOptions.tsx index f8684a8414..54fba10de3 100644 --- a/apps/admin-x-settings/src/components/settings/membership/portal/SignupOptions.tsx +++ b/apps/admin-x-settings/src/components/settings/membership/portal/SignupOptions.tsx @@ -1,5 +1,4 @@ import React, {useCallback, useEffect, useMemo} from 'react'; -import useFeatureFlag from '../../../../hooks/useFeatureFlag'; import {CheckboxGroup, CheckboxProps, Form, HtmlField, Select, SelectOption, Toggle} from '@tryghost/admin-x-design-system'; import {Setting, SettingValue, checkStripeEnabled, getSettingValues} from '@tryghost/admin-x-framework/api/settings'; import {Tier, getPaidActiveTiers} from '@tryghost/admin-x-framework/api/tiers'; @@ -14,7 +13,6 @@ const SignupOptions: React.FC<{ setError: (key: string, error: string | undefined) => void }> = ({localSettings, updateSetting, localTiers, updateTier, errors, setError}) => { const {config} = useGlobalData(); - const hasPortalImprovements = useFeatureFlag('portalImprovements'); const [membersSignupAccess, portalName, portalSignupTermsHtml, portalSignupCheckboxRequired, portalPlansJson, portalDefaultPlan] = getSettingValues( localSettings, ['members_signup_access', 'portal_name', 'portal_signup_terms_html', 'portal_signup_checkbox_required', 'portal_plans', 'portal_default_plan'] ); @@ -52,16 +50,14 @@ const SignupOptions: React.FC<{ updateSetting('portal_plans', JSON.stringify(portalPlans)); // Check default plan is included - if (hasPortalImprovements) { - if (portalDefaultPlan === 'yearly') { - if (!portalPlans.includes('yearly') && portalPlans.includes('monthly')) { - updateSetting('portal_default_plan', 'monthly'); - } - } else if (portalDefaultPlan === 'monthly') { - if (!portalPlans.includes('monthly')) { - // If both yearly and monthly are missing from plans, still set it to yearly - updateSetting('portal_default_plan', 'yearly'); - } + if (portalDefaultPlan === 'yearly') { + if (!portalPlans.includes('yearly') && portalPlans.includes('monthly')) { + updateSetting('portal_default_plan', 'monthly'); + } + } else if (portalDefaultPlan === 'monthly') { + if (!portalPlans.includes('monthly')) { + // If both yearly and monthly are missing from plans, still set it to yearly + updateSetting('portal_default_plan', 'yearly'); } } }; @@ -79,7 +75,7 @@ const SignupOptions: React.FC<{ tiersCheckboxes.push({ checked: (portalPlans.includes('free')), disabled: isDisabled, - label: hasPortalImprovements ? tier.name : 'Free', + label: tier.name, value: 'free', onChange: (checked) => { if (portalPlans.includes('free') && !checked) { @@ -158,7 +154,7 @@ const SignupOptions: React.FC<{ ]} title='Prices available at signup' /> - {(hasPortalImprovements && portalPlans.includes('yearly') && portalPlans.includes('monthly')) && + {(portalPlans.includes('yearly') && portalPlans.includes('monthly')) &&