From 7c1a732a300e367388fe028daa18a918c0df6b7e Mon Sep 17 00:00:00 2001 From: Princi Vershwal Date: Thu, 18 Jul 2024 19:33:15 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixed=20publishing=20issue=20whe?= =?UTF-8?q?n=20site=20has=20no=20active=20newsletters=20(#20627)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ref [ENG-1253](https://linear.app/tryghost/issue/ENG-1253/) Not allowing users to archive their last active newsletter --- .../settings/email/newsletters/NewsletterDetailModal.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 a762d5a707..0b73777146 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 @@ -106,8 +106,15 @@ const Sidebar: React.FC<{ const {localSettings} = useSettingGroup(); const [siteTitle] = getSettingValues(localSettings, ['title']) as string[]; const handleError = useHandleError(); + const {data: {newsletters: apiNewsletters} = {}} = useBrowseNewsletters(); let newsletterAddress = renderSenderEmail(newsletter, config, defaultEmailAddress); + const [newsletters, setNewsletters] = useState(apiNewsletters || []); + const activeNewsletters = newsletters.filter(n => n.status === 'active'); + + useEffect(() => { + setNewsletters(apiNewsletters || []); + }, [apiNewsletters]); const fontOptions: SelectOption[] = [ {value: 'serif', label: 'Elegant serif', className: 'font-serif'}, @@ -252,7 +259,7 @@ const Sidebar: React.FC<{ />
- {newsletter.status === 'active' ? (!onlyOne &&
},