Make WordPress Core

Changes between Initial Version and Version 3 of Ticket #65639


Ignore:
Timestamp:
08/04/2026 06:34:44 AM (5 weeks ago)
Author:
adamsilverstein
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #65639

    • Property Keywords commit added
    • Property Milestone Awaiting Review7.1
    • Property Owner set to adamsilverstein
    • Property Status newassigned
    • 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.
     1Split 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.
    22
    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>`.
     3When 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>`.
    44
    5 '''Proposed behavior'''
     5**Proposed behavior**
    66
    77On `rest_insert_comment` for `note` comments (alongside the existing post-author notification), a new `wp_notify_note_mentions()`:
    88
    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.
     91. **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.
     102. **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()`.
    1211
    13 '''Audience rules'''
     12That is the whole feature.
     13
     14**Audience rules**
    1415
    1516 * The post author is excluded; `wp_new_comment_via_rest_notify_postauthor()` already notifies them of every note.
    1617 * The note's own author is never notified about their own note.
    1718 * 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.
    1820 * Everything honors the existing `wp_notes_notify` option.
    1921
    20 New filters: `wp_note_notification_recipients`, `wp_note_notification_subject`, `wp_note_notification_text`.
     22**New public API**
    2123
    22 '''Patch'''
     24Three 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
     30Existing 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**
    2333
    2434Pull request: https://github.com/WordPress/wordpress-develop/pull/12548
    2535
    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.
     36Ports 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.
    2737
    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
    2945
    3046 * #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