From 923a9a1cd6b4f1490e6eaf7e73797714977b9266 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Wed, 8 Feb 2023 11:41:48 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixed=20default=20email=20recipi?= =?UTF-8?q?ents=20always=20being=20"everyone"=20rather=20than=20matching?= =?UTF-8?q?=20post=20visibility=20(#16247)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refs https://github.com/TryGhost/Ghost/issues/16125 The previous fix for incorrect recipient details being shown when re-sending a failed email introduced another bug that prevented the "Match post visibility" default recipients setting from working. - the server always sets `post.emailSegment` to `'all'` for new posts so the publish flow recipient filter logic that checked for `post.emailSegment` being present always defaulted to `'all'` rather than falling back to the selected default recipients setting - when a post has been published but the email failed it will have its `newsletter` value set so we can use that as a check for using the `post.emailSegment` value in place of the default recipients setting --- ghost/admin/app/utils/publish-options.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ghost/admin/app/utils/publish-options.js b/ghost/admin/app/utils/publish-options.js index e1ea9730a4..bf9954f42e 100644 --- a/ghost/admin/app/utils/publish-options.js +++ b/ghost/admin/app/utils/publish-options.js @@ -168,7 +168,7 @@ export default class PublishOptions { } get recipientFilter() { - return this.selectedRecipientFilter || this.post.emailSegment || this.defaultRecipientFilter; + return this.selectedRecipientFilter || (this.post.newsletter && this.post.emailSegment) || this.defaultRecipientFilter; } get defaultRecipientFilter() {