Skip to content

Newsletter menu: do not display when not connected to WordPress.com#47927

Open
jeherve wants to merge 6 commits intotrunkfrom
fix/newsletter-non-connected
Open

Newsletter menu: do not display when not connected to WordPress.com#47927
jeherve wants to merge 6 commits intotrunkfrom
fix/newsletter-non-connected

Conversation

@jeherve
Copy link
Copy Markdown
Member

@jeherve jeherve commented Apr 3, 2026

Fixes NL-577

Proposed changes

On self-hosted and WoW sites, there are 2 additional use-cases we need to take into account when displaying the Newsletter submenu and the Newsletter settings page:

  • When a site is not connected to WordPress.com yet => we should not display the Newsletter submenu at all.
  • When a site is connected to WordPress.com, but has no connected user yet, we should not allow access to the Newsletter settings but we should invite the admin to connect their account, just like we used to do in the legacy Jetpack > Settings > Newsletter screen.
image

Other information

Related product discussion/links

na

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

no

Testing instructions

  • Start with a brand new site that's not connected to WordPress.com yet (like a brand new JN site)
  • Check the Jetpack menu
    • On trunk, the Newsletter submenu appears
    • On this branch, it does not.
  • Connect your site to WordPress.com. During the connection process, stop when it is asking you to connect your account. Go back to wp-admin at that point.
    • The Newsletter menu should appear
    • When visiting that page, you should see the screenshot above.
    • Click on the link to connect your account as well this time.
    • The Newsletter settings should then be accessible.
  • On WordPress.com simple, nothing should change. The submenu should always appear, the settings should remain accessible.

On self-hosted and WoW sites, we should only display the menu item if folks can use the toggles in there, i.e. if the site is connected.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

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 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 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

@github-actions github-actions bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Apr 3, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

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 WoA dev 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 (Jetpack or WordPress.com Site Helper), and enable the fix/newsletter-non-connected branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack fix/newsletter-non-connected
bin/jetpack-downloader test jetpack-mu-wpcom-plugin fix/newsletter-non-connected

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

@jeherve jeherve self-assigned this Apr 3, 2026
@jeherve jeherve requested a review from dsas April 3, 2026 13:41
@jeherve jeherve added Bug When a feature is broken and / or not performing as intended [Feature] Subscriptions All subscription-related things such as paid and unpaid, user management, and newsletter settings. [Status] Needs Review This PR is ready for review. [Pri] High and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. labels Apr 3, 2026
@jeherve jeherve requested a review from a team April 3, 2026 13:41
@jeherve jeherve changed the title Admin menu: do not display when not connected to WordPress.com Newsletter menu: do not display when not connected to WordPress.com Apr 3, 2026
@jp-launch-control
Copy link
Copy Markdown

jp-launch-control bot commented Apr 3, 2026

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/packages/newsletter/src/class-settings.php 13/159 (8.18%) 8.18% -11 💚

17 files are newly checked for coverage. Only the first 5 are listed here.

File Coverage
projects/packages/newsletter/src/settings/api.ts 0/50 (0.00%) 💔
projects/packages/newsletter/src/settings/components/byline-preview.tsx 0/10 (0.00%) 💔
projects/packages/newsletter/src/settings/components/toggle-with-link.tsx 0/8 (0.00%) 💔
projects/packages/newsletter/src/settings/sections/email-byline-section.tsx 0/5 (0.00%) 💔
projects/packages/newsletter/src/settings/sections/email-content-section.tsx 0/3 (0.00%) 💔

Full summary · PHP report · JS report

If appropriate, add one of these labels to override the failing coverage check: Covered by non-unit tests Use to ignore the Code coverage requirement check when E2Es or other non-unit tests cover the code Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage.

Add Settings_Test to verify that the newsletter admin menu is not
registered when the site is not connected to WordPress.com, and that
it is registered at the correct priority when connected.
Copy link
Copy Markdown
Member

@mehmoodak mehmoodak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Settings > Newsletter tab is now hidden while before it was present.
❌ Sidebar > Jetpack > Newsletter menu item is now present while before it was hidden.

Trunk Branch
Image Image

@jeherve jeherve added [Status] In Progress and removed [Status] Needs Review This PR is ready for review. labels Apr 3, 2026
@jeherve
Copy link
Copy Markdown
Member Author

jeherve commented Apr 3, 2026

Following our discussion at p1775228718136869/1775224746.641709-slack-C03NLNTPZ2T I implemented a check to ensure we display the page appropriately when the site is connected, but has not connected admin yet. Just like for the legacy Jetpack > Settings > Newsletter page, I added:

  • An overlay so the page's options are not accessible until you connect
  • A notice (I find its look a bit underwhelming but it does use Core components, which is what we're going for in this new page) to invite folks to connect their user account.
image

This was done in 926bd62

@jeherve jeherve added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Apr 3, 2026
@jeherve jeherve requested a review from mehmoodak April 3, 2026 16:51
Copy link
Copy Markdown
Member

@mehmoodak mehmoodak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks much better now. Thanks for the improvements.

Tested the changes and noted following things:

  1. pointer-events: none is not working and click events are passing through to what's beneath.
  2. Elements can be toggled even when they appear as disabled ... previously in Newsletter tab it was not possible to toggle them.
  3. More tests for this additional code would be nice 🙂
Screen.Recording.2026-04-03.at.9.49.56.PM.mov

Fix the disabled overlay for non-connected users: use pointer-events: all
to block clicks, wrap settings in <Disabled> for defense-in-depth, adjust
overlay opacity to 0.6 and extend it to cover the section border.

Add Jest tests verifying the connect notice and disabled state render
correctly based on connection status.
@jeherve
Copy link
Copy Markdown
Member Author

jeherve commented Apr 3, 2026

Thanks for the review, good catches. I just pushed 6f00df8 to hopefully address all that feedback.

mehmoodak
mehmoodak previously approved these changes Apr 3, 2026
Copy link
Copy Markdown
Member

@mehmoodak mehmoodak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing well, thanks for doing all the extra work on top of a simple fix. Change looks much better now.

See #47927 (comment)

Co-authored-by: Mehmood Ahmad <31419912+mehmoodak@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug When a feature is broken and / or not performing as intended [Feature] Subscriptions All subscription-related things such as paid and unpaid, user management, and newsletter settings. [Package] Newsletter [Pri] High [Status] Needs Review This PR is ready for review. [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants