Skip to content

Monitor: Store the downtime email setting per user - #53384

Open
kraftbj wants to merge 2 commits into
trunkfrom
astana/jetpack-2962-review-pr
Open

kraftbj wants to merge 2 commits into
trunkfrom
astana/jetpack-2962-review-pr

Conversation

@kraftbj

@kraftbj kraftbj commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Fixes JETPACK-2962

Proposed changes

  • jetpack/v4/settings returns monitor_receive_notifications from a local copy of the user's WordPress.com email subscription. That copy was a single site option, so every admin read whichever value was saved last. It is now keyed by user ID, the same way post_by_email_address already is.
  • A failed lookup (a user with no WordPress.com connection, say) is no longer saved as "off", so connecting later isn't stuck behind a stale answer.
  • The copy is stored as 1/0. update_option() won't create an option whose value is false, which meant an "off" answer was never saved and was fetched again on every settings request.

Nothing in trunk binds a toggle to this value today (Settings → Security only has the module toggle), so this is inherited rather than new. The Monitor card in PR 53194 is the first UI to show it, and it needs no change: it already reads this setting.

The old shared monitor_receive_notifications option is no longer read or written. I left it in place, and left the name in the Sync options list.

Related product discussion/links

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

No.

Testing instructions

You need a site connected to WordPress.com with two admins, each connected to their own WordPress.com account, and Monitor active. Check out PR 53194 with this branch merged in to use the Monitor card, or use the API directly as below.

  • As admin A, turn the email setting on: POST /wp-json/jetpack/v4/settings with { "monitor_receive_notifications": true }.
  • As admin B, turn it off the same way.
  • As each admin, GET /wp-json/jetpack/v4/settings and check monitor_receive_notifications. A sees true, B sees false. On trunk both see false.
  • Add a third admin with no WordPress.com connection. They see false, and wp option get monitor_receive_notifications<their user ID> shows nothing was saved for them.

The settings endpoint cached the current user's WordPress.com email
subscription in a single site option, so every admin read whichever
value was saved last. Key the local copy by user ID, as Post by Email
already does, and stop caching a failed lookup.
@kraftbj kraftbj added Bug When a feature is broken and / or not performing as intended [Status] In Progress labels Oct 8, 2026
@kraftbj kraftbj self-assigned this Oct 8, 2026
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

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), and enable the astana/jetpack-2962-review-pr branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack astana/jetpack-2962-review-pr

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 [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Tests] Includes Tests labels Oct 8, 2026
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
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 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!


Jetpack plugin:

No scheduled milestone found for this plugin.

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

@jp-launch-control

jp-launch-control Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 2 files.

File Coverage Δ% Δ Uncovered
projects/plugins/jetpack/_inc/lib/class.core-rest-api-endpoints.php 1640/2349 (69.82%) 0.01% 0 💚
projects/plugins/jetpack/src/abilities/class-monitor-abilities.php 153/187 (81.82%) 0.10% 0 💚

Full summary · PHP report · JS report

Neither lookup leaves an error or null in the value now, so Phan
flagged the comparison as impossible.
@kraftbj
kraftbj marked this pull request as ready for review October 8, 2026 21:02
@kraftbj kraftbj added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Oct 8, 2026

This branch has not been deployed

No deployments
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 [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [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.

1 participant