Changes between Initial Version and Version 3 of Ticket #65639
- Timestamp:
- 08/04/2026 06:34:44 AM (5 weeks ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #65639
- Property Keywords commit added
- Property Milestone Awaiting Review → 7.1
- Property Owner set to
- Property Status new → assigned
- Property Type defect (bug) → enhancement
-
Ticket #65639 – Description
initial v3 1 Split out of #65622, which now covers only the kses allowance that lets note @mention markup survive sanitization. This ticket covers the '''notification layer'''for Notes @mentions.1 Split out of #65622, which now covers only the kses allowance that lets note @mention markup survive sanitization. This ticket covers the **notification layer** for Notes @mentions. 2 2 3 When a collaborator is @mentioned in a note, or is following a note thread, they should be emailed so they hear about it. The Gutenberg Notes @mention completer stores each mention as a link carrying a `user-N` class token, e.g. `<a class="wp-note-mention user-5" href="…">@Name</a>`.3 When a collaborator is @mentioned in a note, they should be emailed so they hear about it. The Gutenberg Notes @mention completer stores each mention as a chip carrying the mentioned user's ID in a class token: `<span class="wp-note-mention user-N">@Name</span>`. 4 4 5 '''Proposed behavior''' 5 **Proposed behavior** 6 6 7 7 On `rest_insert_comment` for `note` comments (alongside the existing post-author notification), a new `wp_notify_note_mentions()`: 8 8 9 1. '''Parses mentions''' out of the saved content via `wp_get_note_mentioned_user_ids()`. Only anchors carrying both the `wp-note-mention` class and a `user-N` class token are treated as mentions, so ordinary links cannot be used to address notifications. 10 2. '''Notifies''' each mentioned user plus any existing followers of the thread with a short email linking back to the post (`wp_send_note_notification()`). 11 3. '''Subscribes''' the note author and everyone they mention to the thread. Followers are stored as one `_wp_note_followers` meta row per user on the thread's top-level note, so concurrent replies cannot clobber each other, and the meta is registered for REST (editable by users who can `edit_comment` the note) so a follower-management UI can build on it. 9 1. **Parses mentions** out of the saved content via `wp_get_note_mentioned_user_ids()`. Only elements carrying both the `wp-note-mention` class and a `user-N` class token are treated as mentions, so ordinary markup cannot be used to address notifications. 10 2. **Emails** each mentioned user a short message linking back to the post editor (`wp_send_note_notification()`), composed in the recipient's locale via `switch_to_user_locale()`. 12 11 13 '''Audience rules''' 12 That is the whole feature. 13 14 **Audience rules** 14 15 15 16 * The post author is excluded; `wp_new_comment_via_rest_notify_postauthor()` already notifies them of every note. 16 17 * The note's own author is never notified about their own note. 17 18 * Recipients are limited to users who can `edit_comment` the note, matching `WP_REST_Comments_Controller::check_read_permission()` for notes, so emails cannot leak note content to users who cannot see the note in the editor. 19 * Notifications fire only when a note is created; editing a note does not re-notify. 18 20 * Everything honors the existing `wp_notes_notify` option. 19 21 20 New filters: `wp_note_notification_recipients`, `wp_note_notification_subject`, `wp_note_notification_text`. 22 **New public API** 21 23 22 '''Patch''' 24 Three functions, and no new filters: 25 26 * `wp_get_note_mentioned_user_ids( $content )` 27 * `wp_notify_note_mentions( $comment, $request, $creating )` 28 * `wp_send_note_notification( $user, $comment, $post )` 29 30 Existing hooks cover extension: `comment_notification_recipients` already runs on every note through `wp_notify_postauthor()`, so extra recipients can be added there, and `pre_wp_mail` / `wp_mail` can suppress delivery or reroute it to another channel. 31 32 **Patch** 23 33 24 34 Pull request: https://github.com/WordPress/wordpress-develop/pull/12548 25 35 26 Ports the notification layer from Gutenberg PR https://github.com/WordPress/gutenberg/pull/79606 ( still open upstream; this should not land until it merges). The kses half is in #65622 / https://github.com/WordPress/wordpress-develop/pull/12503.36 Ports the notification layer from Gutenberg PR https://github.com/WordPress/gutenberg/pull/79606 (approved, but still open upstream; this should not land until it merges). The kses half is in #65622 / https://github.com/WordPress/wordpress-develop/pull/12503. 27 37 28 === Related === 38 **Scope changes since this ticket was filed** 39 40 * The per-thread **followers** model (subscribing participants, `_wp_note_followers` meta, notifying on replies) was dropped. It is tracked upstream in Gutenberg #80279 and would be a separate ticket here. 41 * The `wp_note_notification_recipients`, `wp_note_notification_subject` and `wp_note_notification_text` filters were dropped in favor of the existing comment and mail hooks. 42 * Mention markup moved from anchors to `span` chips in Gutenberg #80528, so the parser matches spans rather than anchors. 43 44 ### Related 29 45 30 46 * #65622 - Notes @mention kses allowance (the other half of this work) 31 * Gutenberg #79606 - upstream source PR (open) 32 * Gutenberg #79604, #80221 - upstream kses PRs (merged) 47 * Gutenberg #79606 - upstream source PR (open, approved) 48 * Gutenberg #79604, #80221, #80528 - upstream mention markup and kses PRs (merged) 49 * Gutenberg #80279 - per-thread followers, split out of this work
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)