Skip to content
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

Merged
merged 14 commits into from
May 22, 2024
Merged

Conversation

enejb
Copy link
Member

@enejb enejb commented May 13, 2024

Fixes #37354

Proposed changes:

  • This PR adds the Jetpack side of the reply to name fields. Which will let users define what the newsletters name is set to by default this setting is set to the blog name or WordPress .com if the blogname is not set.

New setting when
Default state
Screenshot 2024-05-15 at 1 29 00 PM

my site is called Enej Dev jetpack.

After typing in some content before save.
Screenshot 2024-05-15 at 1 29 36 PM

Related .com PR D148558-code

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

Does this pull request change what data or activity we track or use?

Testing instructions:

  1. load this branch
  2. Visit /wp-admin/admin.php?page=jetpack&enable-newsletter-from-name=true#/newsletter on your jetpack site.
  3. Save the option. (Notice that without enable-newsletter-from-name=true query parameter "feature" flag the option is not available.
  4. Notice that saving works and the option is still there as expected when you refresh the page.

@enejb enejb added the [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. label May 13, 2024
@enejb enejb requested a review from a team May 13, 2024 21:32
@enejb enejb self-assigned this May 13, 2024
Copy link
Contributor

github-actions bot commented May 13, 2024

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WordPress.com Simple site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin, and enable the add/newsletter-reply-name branch.

    • For jetpack-mu-wpcom changes, also add define( 'JETPACK_MU_WPCOM_LOAD_VIA_BETA_PLUGIN', true ); to your wp-config.php file.
  • To test on Simple, run the following command on your sandbox:

    bin/jetpack-downloader test jetpack add/newsletter-reply-name
    
    bin/jetpack-downloader test jetpack-mu-wpcom-plugin add/newsletter-reply-name
    

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions bot added [Feature] WPCOM API [Package] Sync [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Tests] Includes Tests Admin Page React-powered dashboard under the Jetpack menu labels May 13, 2024
Copy link
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

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.
Then, add the "[Status] Needs Team Review" label and ask someone from your team review the code. Once reviewed, it can then be merged.
If you need an extra review from someone familiar with the codebase, you can update the labels from "[Status] Needs Team Review" to "[Status] Needs Review", and in that case Jetpack Approvers will do a final review of your PR.


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen daily.
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly. The next release is scheduled for June 4, 2024 (scheduled code freeze on June 3, 2024).

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@enejb enejb force-pushed the add/newsletter-reply-name branch from 2056014 to 5ff3a51 Compare May 13, 2024 21:36
@enejb enejb added this to the jetpack/13.5 milestone May 13, 2024
@simison
Copy link
Member

simison commented May 14, 2024

This PR adds the Jetpack side of the reply to name fields.

This should be From name:

Screenshot 2024-05-14 at 11 12 22

@simison
Copy link
Member

simison commented May 14, 2024

@crisbusquets thoughts on having the site's actual name (i.e. the default value for From) in the input:

  • as input's greyed out placeholder, or
    Screenshot 2024-05-14 at 11 20 06

  • as actual value in the input, but not save it in the database if it matches the site name. If site name gets changed elsewhere, the value also gets changed until they write something custom in the input.
    Screenshot 2024-05-14 at 11 19 54

@crisbusquets
Copy link
Contributor

@crisbusquets thoughts on having the site's actual name (i.e. the default value for From) in the input:

  • as input's greyed out placeholder, or
    Screenshot 2024-05-14 at 11 20 06
  • as actual value in the input, but not save it in the database if it matches the site name. If site name gets changed elsewhere, the value also gets changed until they write something custom in the input.
    Screenshot 2024-05-14 at 11 19 54

I like it. This way users will know "where the name comes from".

@simison
Copy link
Member

simison commented May 14, 2024

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.

@enejb enejb changed the title Newsletter: Add reply to name Newsletter: Add "From" name customization May 14, 2024
@enejb
Copy link
Member Author

enejb commented May 14, 2024

I like the idea of using the placeholder idea. Will implemnt that and see how that works.

@jeherve jeherve added [Status] In Progress and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels May 15, 2024
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 : {};
Copy link
Member

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:

You'll find that the blogname option is already available there:

'siteTitle' => (string) htmlspecialchars_decode( get_option( 'blogname' ), ENT_QUOTES ),

It's available for you to use via this reducer:

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.

@crisbusquets
Copy link
Contributor

crisbusquets commented May 15, 2024

Here's the Figma:

34772-pb/

@simison
Copy link
Member

simison commented May 15, 2024

Would adding some copy or example line help people understand this is the "name" part, so that they won't start entering emails here? The line would update with the value in the input.

Screenshot 2024-05-15 at 10 37 21

Might be non-issue too.

@crisbusquets
Copy link
Contributor

Would adding some copy or example line help people understand this is the "name" part, so that they won't start entering emails here? The line would update with the value in the input.

Screenshot 2024-05-15 at 10 37 21 Might be non-issue too.

I like the idea, but would we be able to dynamically update it if they later change the 'reply-to' email?

@simison
Copy link
Member

simison commented May 15, 2024

would we be able to dynamically update it if they later change the 'reply-to' email?

Yep! I think the help-line should update as you type.

@enejb
Copy link
Member Author

enejb commented May 15, 2024

This is what I have at the moment. And the value changes as you update the from name and the reply to.

Screenshot 2024-05-15 at 1 26 53 PM

@enejb enejb force-pushed the add/newsletter-reply-name branch from cfdaf22 to 5034f51 Compare May 21, 2024 23:18
@@ -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 );
Copy link
Contributor

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

lezama
lezama previously approved these changes May 22, 2024
@enejb enejb enabled auto-merge (squash) May 22, 2024 19:48
@enejb enejb force-pushed the add/newsletter-reply-name branch from 5034f51 to 61dd6a4 Compare May 22, 2024 20:16
@enejb enejb merged commit ebd793c into trunk May 22, 2024
73 of 74 checks passed
@enejb enejb deleted the add/newsletter-reply-name branch May 22, 2024 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Admin Page React-powered dashboard under the Jetpack menu [Feature] WPCOM API [Package] Connection [Package] Sync [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Tests] Includes Tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Newsletter: allow customizing "From" name
5 participants