Skip to content

RTC: Send bell notification to plan owner when non-admin is blocked by collaborator limit#48001

Open
rcrdortiz wants to merge 9 commits intotrunkfrom
dotcom-16367-rtc-bell-notification
Open

RTC: Send bell notification to plan owner when non-admin is blocked by collaborator limit#48001
rcrdortiz wants to merge 9 commits intotrunkfrom
dotcom-16367-rtc-bell-notification

Conversation

@rcrdortiz
Copy link
Copy Markdown
Contributor

Fixes DOTCOM-16367

Proposed changes

  • Add a reusable lib/ directory to jetpack-mu-wpcom with generic helper functions that work on both Simple and Atomic/WoW sites:
    • wpcom_get_site_owner_id() — resolves the site/plan owner user ID across environments
    • wpcom_is_site_owner() — checks if the current user is the site owner
    • wpcom_send_bell_notification() — sends a WordPress.com bell notification (no-ops gracefully when unavailable)
  • Add AGENTS.md to the lib directory as agent-first documentation for AI agents to discover available operations
  • Update the RTC package to delegate is_plan_owner() and get_plan_owner_id() to the new lib functions
  • When a non-admin user is blocked from joining an editor session due to the collaborator limit, send a rate-limited bell notification to the plan owner
    • Rate-limited to once per 24h per (blog, post, blocked user) combination
    • Only fires when jetpack_rtc_enable_limit_notices filter is enabled

Other information

The lib/ directory is designed as an agent-first API surface — the AGENTS.md file serves as the primary discovery mechanism for AI agents working in the codebase. The functions use the wpcom_ prefix consistent with existing conventions and are loaded early via lib/load.php.

Related product discussion/links

  • peKye1-1Z1-p2

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

No.

Testing instructions

  • Open a post editor on a WoW site with RTC enabled and jetpack_rtc_enable_limit_notices filter returning true
  • With a non-admin user, try to join an editor session that has reached the collaborator limit
  • Verify a bell notification is sent to the plan owner
  • Verify that a second attempt within 24h does not send another notification (rate limiting via transient)
  • Verify the notification does not fire when jetpack_rtc_enable_limit_notices is false (default)

@rcrdortiz rcrdortiz added the [Status] Needs Review This PR is ready for review. label Apr 8, 2026
@rcrdortiz rcrdortiz self-assigned this Apr 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 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 (WordPress.com Site Helper), and enable the dotcom-16367-rtc-bell-notification branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack-mu-wpcom-plugin dotcom-16367-rtc-bell-notification

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

github-actions bot commented Apr 8, 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!

@jp-launch-control
Copy link
Copy Markdown

jp-launch-control bot commented Apr 8, 2026

Code Coverage Summary

Cannot generate coverage summary while tests are failing. 🤐

Please fix the tests, or re-run the Code coverage job if it was something being flaky.

Full summary · PHP report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant