Repository navigation
Comments: Only email the post author when a note is created. - #16369
adamsilverstein wants to merge 3 commits into
Conversation
Editing a note through the REST API sends the post author the "new note" email again, because wp_new_comment_via_rest_notify_postauthor() runs on every rest_insert_comment, creates and updates alike. These tests fail until that is fixed: the e2e spec adds and edits a note in the editor and counts the emails the post author gets, and the PHPUnit tests cover the create and update requests directly. See #66891. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018vwYjTtzMQnfuAJYcpNH6Z
rest_insert_comment fires for both creates and updates, and the post author callback ignored its $creating argument, so each edit to a note re-sent the "new note" email. The callback now takes the action's three arguments and returns early on updates, matching wp_notify_note_mentions() on the same hook. Direct callers that pass only the comment keep the old behavior, since $creating defaults to true. Fixes #66891. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018vwYjTtzMQnfuAJYcpNH6Z
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Declares `$creating` as a native bool, matching wp_notify_note_mentions() on the same hook, so a non-boolean value cannot slip past the update check. The `$request` docblock now allows its null default. See #66891. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018vwYjTtzMQnfuAJYcpNH6Z
Claude Code (Opus 5.5) reproduced this in the editor, then wrote the fix and tests:
AI Use
Claude Code (Opus 5.5) wrote the fix, both sets of tests, and this description. I will review and test.
🤖 Generated with Claude Code
https://claude.ai/code/session_018vwYjTtzMQnfuAJYcpNH6Z