From 28919eb057117eabde8d7c1f74923336be5a1e1e Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Wed, 11 May 2022 09:43:55 +0100 Subject: [PATCH] Fixed "Already sent" showing in publish options when email disabled in settings refs https://github.com/TryGhost/Admin/commit/46f01c2d8f95dcbef1913fe41bbad1b51315fed1 - if you had previously had emails enabled and you had sent a post as an email, when disabling members/emails all email related UI was hidden except for the "Already sent as email" message when publishing which was confusing as there is no other indication anywhere about emails and no way to view it - added `emailDisabledInSettings` getter to PublishOptions - used in `emailUnavailable` getter in place of a duplicate read of the settings - used in the `` component to conditionally hide the "Already sent" message --- .../editor-labs/modals/publish-flow/options.hbs | 2 +- .../app/components/editor-labs/publish-management.js | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ghost/admin/app/components/editor-labs/modals/publish-flow/options.hbs b/ghost/admin/app/components/editor-labs/modals/publish-flow/options.hbs index 61873c4f6c..f820ad9534 100644 --- a/ghost/admin/app/components/editor-labs/modals/publish-flow/options.hbs +++ b/ghost/admin/app/components/editor-labs/modals/publish-flow/options.hbs @@ -82,7 +82,7 @@ {{/unless}} - {{#if @publishOptions.post.email}} + {{#if (and @publishOptions.post.email (not @publishOptions.emailDisabledInSettings))}}
{{svg-jar "member"}} diff --git a/ghost/admin/app/components/editor-labs/publish-management.js b/ghost/admin/app/components/editor-labs/publish-management.js index 851ebbdaf7..bacbdb109a 100644 --- a/ghost/admin/app/components/editor-labs/publish-management.js +++ b/ghost/admin/app/components/editor-labs/publish-management.js @@ -112,12 +112,14 @@ export class PublishOptions { return this.publishTypeOptions.find(pto => pto.value === this.publishType); } + get emailDisabledInSettings() { + return get(this.settings, 'editorDefaultEmailRecipients') === 'disabled' + || get(this.settings, 'membersSignupAccess') === 'none'; + } + // publish type dropdown is not shown at all get emailUnavailable() { - const emailDisabled = get(this.settings, 'editorDefaultEmailRecipients') === 'disabled' - || get(this.settings, 'membersSignupAccess') === 'none'; - - return this.post.isPage || this.post.email || !this.user.canEmail || emailDisabled; + return this.post.isPage || this.post.email || !this.user.canEmail || this.emailDisabledInSettings; } // publish type dropdown is shown but email options are disabled