From 7d04d5d9a076cf6b7fad3e5d9f35cb94e3bff23a Mon Sep 17 00:00:00 2001 From: Francesco Bigiarini Date: Tue, 14 Jan 2025 15:27:29 +0100 Subject: [PATCH 1/2] Fix: newsletter toggle in editor sidebar has a visually broken active state --- .../jetpack/extensions/shared/memberships/settings.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/projects/plugins/jetpack/extensions/shared/memberships/settings.js b/projects/plugins/jetpack/extensions/shared/memberships/settings.js index 387c50720714b..3b8118cf12c5c 100644 --- a/projects/plugins/jetpack/extensions/shared/memberships/settings.js +++ b/projects/plugins/jetpack/extensions/shared/memberships/settings.js @@ -306,7 +306,7 @@ export function NewsletterEmailDocumentSettings() { const postMetaUpdate = { ...postMeta, // Meta value is negated, "don't send", but toggle is truthy when enabled "send" - [ META_NAME_FOR_POST_DONT_EMAIL_TO_SUBS ]: ! value, + [ META_NAME_FOR_POST_DONT_EMAIL_TO_SUBS ]: value === 'post-only', }; setPostMeta( postMetaUpdate ); saveEditedEntityRecord( 'postType', postType, postId ); @@ -315,7 +315,7 @@ export function NewsletterEmailDocumentSettings() { const isSendEmailEnabled = useSelect( select => { const meta = select( editorStore ).getEditedPostAttribute( 'meta' ); // Meta value is negated, "don't send", but toggle is truthy when enabled "send" - return ! meta?.[ META_NAME_FOR_POST_DONT_EMAIL_TO_SUBS ]; + return meta?.[ META_NAME_FOR_POST_DONT_EMAIL_TO_SUBS ] ? 'post-only' : 'post-and-email'; } ); return ( @@ -333,8 +333,11 @@ export function NewsletterEmailDocumentSettings() { __nextHasNoMarginBottom={ true } __next40pxDefaultSize={ true } > - - + + ); } } From 046985cadc26dff388174e21b7c3028afaf09195 Mon Sep 17 00:00:00 2001 From: Francesco Bigiarini Date: Tue, 14 Jan 2025 15:30:01 +0100 Subject: [PATCH 2/2] Add changelog entry --- .../plugins/jetpack/changelog/fix-broken-newsletter-toggle | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 projects/plugins/jetpack/changelog/fix-broken-newsletter-toggle diff --git a/projects/plugins/jetpack/changelog/fix-broken-newsletter-toggle b/projects/plugins/jetpack/changelog/fix-broken-newsletter-toggle new file mode 100644 index 0000000000000..d2a8a7e5893eb --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-broken-newsletter-toggle @@ -0,0 +1,4 @@ +Significance: patch +Type: bugfix + +Fix: newsletter toggle in editor sidebar has a visually broken active state.