-
Notifications
You must be signed in to change notification settings - Fork 798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Newsletter: Add "From" name customization #37362
Conversation
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Once your PR is ready for review, check one last time that all required checks appearing at the bottom of this PR are passing or skipped. Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
2056014
to
5ff3a51
Compare
@crisbusquets thoughts on having the site's actual name (i.e. the default value for |
I like it. This way users will know "where the name comes from". |
Yes but we'd need to pick one or the other way, or combined both. :-) Placeholder is at least good to have because empty should default to site name. |
I like the idea of using the placeholder idea. Will implemnt that and see how that works. |
const urlParams = new URLSearchParams( window.location.search ); | ||
const isNewsletterReplyToNameEnabled = urlParams.get( 'enable-newsletter-sender-name' ) === 'true'; | ||
|
||
const { blogname } = window?.JP_CONNECTION_INITIAL_STATE ? window.JP_CONNECTION_INITIAL_STATE : {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of relying on the Connection initial state, it may be best to rely on the Jetpack Dashboard initial state, defined here:
jetpack/projects/plugins/jetpack/_inc/lib/admin-pages/class-jetpack-redux-state-helper.php
Line 50 in 8debc85
public static function get_initial_state() { |
You'll find that the blogname
option is already available there:
jetpack/projects/plugins/jetpack/_inc/lib/admin-pages/class-jetpack-redux-state-helper.php
Line 157 in 8debc85
'siteTitle' => (string) htmlspecialchars_decode( get_option( 'blogname' ), ENT_QUOTES ), |
It's available for you to use via this reducer:
jetpack/projects/plugins/jetpack/_inc/client/state/initial-state/reducer.js
Lines 73 to 75 in d4b22e8
export function getSiteTitle( state ) { | |
return get( state.jetpack.initialState, 'siteTitle', '' ); | |
} |
Relying on that will save you from having to make any changes to the Connection package this time around.
Here's the Figma: 34772-pb/ |
Yep! I think the help-line should update as you type. |
projects/plugins/jetpack/_inc/client/newsletter/email-settings.jsx
Outdated
Show resolved
Hide resolved
projects/plugins/jetpack/_inc/client/newsletter/email-settings.jsx
Outdated
Show resolved
Hide resolved
projects/plugins/jetpack/_inc/lib/core-api/class.jetpack-core-api-module-endpoints.php
Show resolved
Hide resolved
cfdaf22
to
5034f51
Compare
@@ -1038,6 +1038,11 @@ function ( &$value ) { | |||
update_option( 'jetpack_subscriptions_reply_to', (string) $to_set_value ); | |||
$updated[ $key ] = (bool) $value; | |||
break; | |||
case 'jetpack_subscriptions_from_name': | |||
$to_set_value = sanitize_text_field( $value ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wondering if sanitizing on saving could return a weird output then when sanitizing on output
…bscriptions_reply_to_name
5034f51
to
61dd6a4
Compare
Fixes #37354
Proposed changes:
New setting when
Default state
my site is called Enej Dev jetpack.
After typing in some content before save.
Related .com PR D148558-code
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
/wp-admin/admin.php?page=jetpack&enable-newsletter-from-name=true#/newsletter
on your jetpack site.enable-newsletter-from-name=true
query parameter "feature" flag the option is not available.