Suggest mode: REST permissions and PHP coverage for note suggestions#78351
Open
adamsilverstein wants to merge 1 commit into
Open
Suggest mode: REST permissions and PHP coverage for note suggestions#78351adamsilverstein wants to merge 1 commit into
adamsilverstein wants to merge 1 commit into
Conversation
Override the comments REST controller for type=note so non-author editors can manage suggestion lifecycle without moderate_comments. Restrict updates to a scope-tightened allowlist (status and _wp_suggestion_status only), enforce a 64 KB payload ceiling on _wp_suggestion before sanitize fires, and add PHPUnit coverage for the new permission surface.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
This was referenced May 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
One of three replacement PRs for the now-closed #77407. This slice is the REST/PHP backend for the Suggest-mode lifecycle.
Tracking issue: #73411.
What's in this PR
lib/compat/wordpress-6.9/class-gutenberg-rest-comment-controller-6-9.phpoverridesupdate_item_permissions_checkso a user withedit_poston the parent can updatenotecomments — but only for suggestion-lifecycle fields (statuslimited toapproved/hold, plusmeta._wp_suggestion_status). Any other field falls back to core'sedit_commentcheck.auth_callbacks —_wp_suggestionand_wp_suggestion_statusboth authorize onedit_postagainst the parent._wp_suggestionpayload, enforced at the controller before sanitize fires (matching the client-side pre-flight cap).class-wp-rest-comments-controller-gutenberg-test.php: meta round-trip, editor-can-apply, contributor-cannot-apply, restricted-field pass-through, payload-size truncation.Pure backend. No JS, no UI. Safe to merge ahead of the rest of the stack.
Test plan
npm run wp-env run cli -- --env-cwd='wp-content/plugins/gutenberg' vendor/bin/phpunit --filter=WP_Test_REST_Comments_Controller_Gutenberg vendor/bin/phpcs lib/compat/wordpress-6.9/class-gutenberg-rest-comment-controller-6-9.php lib/compat/wordpress-6.9/block-comments.phpManual:
edit_post:PATCH /wp/v2/comments/<id>with{ status: 'approved', meta: { _wp_suggestion_status: 'applied' } }— succeeds.PATCH— 403.PATCHwith{ content: 'rewritten' }— falls back to coreedit_comment.PATCHwith{ status: 'spam' }— falls back to coreedit_comment._wp_suggestionmeta payload > 64 KB — 400.Replaces part of #77407.
🗺️ PR Stack Navigation
_wp_suggestionmeta, provider, sidebar actions📋 Tracking issue: #73411