Let authors edit checklists in their own comments - #258
Merged
lancewillett merged 2 commits intoSep 2, 2026
Merged
Conversation
Checklist authorization for comments now applies o2's comment editing rule through the existing restrict_comment_editing capability filter, so authors can change checklists in comments they wrote on posts owned by other users. See: P2HQ-269
Contributor
Author
|
8ad031c adds a PHPUnit case that an Editor can still edit checklists in another user's comment, covering the moderate_comments branch of the reused filter. Suite: 86 tests, 151 assertions pass. |
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.
What changed
Checklist authorization for comments now runs the existing
o2_Write_API::restrict_comment_editing()capability filter around theedit_commentcheck, the same way the comment Edit and Trash actions already do. Authors can tick, edit, delete, and add checklist items in comments they wrote on posts owned by other users. Other users' comments still needmoderate_comments.WordPress core maps
edit_commentto the parent post's edit capabilities and never consults the comment's author, so after #255 removed the role-name fallback an Author lost checklist access to their own comments on someone else's post. The rendered checkbox came out disabled and the AJAX request was refused.The method is now declared
publicand its parameter renamed to$object_idso the WordPress.com mirror passes its coding-standards gate. Behavior is otherwise unchanged.Testing
tests/phpunit/modules/test-checklists.php: an Author's own comment on another Author's post is editable and renders enabled; another user's comment is not editable and renders disabled; logged-out users are denied. The first test fails with the fix reverted.