From acac7801f46789ae2c40eaf4ffa182f38be7e85e Mon Sep 17 00:00:00 2001 From: Sanne de Vries <65487235+sanne-san@users.noreply.github.com> Date: Wed, 29 May 2024 17:59:25 +0200 Subject: [PATCH] Split subhead feature into two feature flags (#20279) REF MOM-119 - Split subhead feature flag into two: editorSubtitle and newsletterSubtitle - Updated UI copy, feature flag names and class names from subhead to subtitle --- .../settings/advanced/labs/AlphaFeatures.tsx | 10 +++++++--- .../email/newsletters/NewsletterDetailModal.tsx | 6 +++--- .../email/newsletters/NewsletterPreviewContent.tsx | 6 +++--- .../admin/app/components/gh-koenig-editor-lexical.hbs | 6 +++--- ghost/admin/app/components/gh-koenig-editor-lexical.js | 6 +++--- ghost/admin/app/components/gh-post-settings-menu.hbs | 2 +- ghost/admin/app/services/feature.js | 3 ++- ghost/admin/app/styles/layouts/editor.css | 4 ++-- ghost/core/core/shared/labs.js | 3 ++- ghost/email-service/lib/EmailRenderer.js | 2 +- .../lib/email-templates/partials/styles-old.hbs | 8 ++++---- .../email-service/lib/email-templates/template-old.hbs | 6 +++--- ghost/email-service/test/email-renderer.test.js | 2 +- 13 files changed, 35 insertions(+), 29 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 5c632a9e74..b0f1859bd6 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 @@ -68,9 +68,13 @@ const features = [{ description: '(Highly) Experimental support for ActivityPub.', flag: 'ActivityPub' },{ - title: 'Subhead', - description: 'Using custom excerpts as subheads in editor and newsletter', - flag: 'subhead' + title: 'Subtitle in editor', + description: 'Using custom excerpt as subtitle in editor', + flag: 'editorSubtitle' +},{ + title: 'Subtitle in newsletter', + description: 'Showing subtitle in newsletter', + flag: 'newsletterSubtitle' }]; const AlphaFeatures: React.FC = () => { diff --git a/apps/admin-x-settings/src/components/settings/email/newsletters/NewsletterDetailModal.tsx b/apps/admin-x-settings/src/components/settings/email/newsletters/NewsletterDetailModal.tsx index ebb5bf11b4..bf4d768cdf 100644 --- a/apps/admin-x-settings/src/components/settings/email/newsletters/NewsletterDetailModal.tsx +++ b/apps/admin-x-settings/src/components/settings/email/newsletters/NewsletterDetailModal.tsx @@ -103,7 +103,7 @@ const Sidebar: React.FC<{ const {mutateAsync: uploadImage} = useUploadImage(); const [selectedTab, setSelectedTab] = useState('generalSettings'); const hasEmailCustomization = useFeatureFlag('emailCustomization'); - const hasSubhead = useFeatureFlag('subhead'); + const hasNewsletterSubtitle = useFeatureFlag('newsletterSubtitle'); const {localSettings} = useSettingGroup(); const [siteTitle] = getSettingValues(localSettings, ['title']) as string[]; const handleError = useHandleError(); @@ -424,11 +424,11 @@ const Sidebar: React.FC<{ title='Body style' onSelect={option => updateNewsletter({body_font_category: option?.value})} /> - {hasSubhead && + {hasNewsletterSubtitle && updateNewsletter({show_subhead: e.target.checked})} /> } diff --git a/apps/admin-x-settings/src/components/settings/email/newsletters/NewsletterPreviewContent.tsx b/apps/admin-x-settings/src/components/settings/email/newsletters/NewsletterPreviewContent.tsx index dbd46cfe59..e5c32a0c87 100644 --- a/apps/admin-x-settings/src/components/settings/email/newsletters/NewsletterPreviewContent.tsx +++ b/apps/admin-x-settings/src/components/settings/email/newsletters/NewsletterPreviewContent.tsx @@ -77,7 +77,7 @@ const NewsletterPreviewContent: React.FC<{ const showHeader = headerIcon || headerTitle; const {config} = useGlobalData(); const hasNewEmailAddresses = useFeatureFlag('newEmailAddresses'); - const hasSubhead = useFeatureFlag('subhead'); + const hasNewsletterSubtitle = useFeatureFlag('newsletterSubtitle'); const currentDate = new Date().toLocaleDateString('default', { year: 'numeric', @@ -134,8 +134,8 @@ const NewsletterPreviewContent: React.FC<{ )} style={{color: titleColor}}> Your email newsletter - {(hasSubhead && showSubhead) && ( -

A subhead that highlights the key points of your newsletter.

+ {(hasNewsletterSubtitle && showSubhead) && ( +

A subtitle that highlights the key points of your newsletter.

)}
- {{#if (feature 'subhead')}} + {{#if (feature 'editorSubtitle')}} {{post.title}} - {{#hasFeature 'subhead'}} + {{#hasFeature 'newsletterSubtitle'}} {{#if newsletter.showSubhead}} - -

Jonathan Haidt wrote a best-selling book about teens and social media. Not everyone buys its thesis.

+ +

Jonathan Haidt wrote a best-selling book about teens and social media. Not everyone buys its thesis.

{{/if}} diff --git a/ghost/email-service/test/email-renderer.test.js b/ghost/email-service/test/email-renderer.test.js index ad0f337d40..c7402c8b11 100644 --- a/ghost/email-service/test/email-renderer.test.js +++ b/ghost/email-service/test/email-renderer.test.js @@ -1995,7 +1995,7 @@ describe('Email renderer', function () { title: 'post-title post-title-serif post-title-left', titleLink: 'post-title-link post-title-link-left', meta: 'post-meta post-meta-left', - subhead: 'post-subhead post-subhead-left', + subtitle: 'post-subtitle post-subtitle-left', body: 'post-content-sans-serif' }); });