-
Notifications
You must be signed in to change notification settings - Fork 3.2k
WP_Comment_Query: exclude the 'note' type, unless 'all' or 'note' type explicitly requested #10405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…e explicitly requested
|
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 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. |
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. |
|
This seems like the best and safest solution to me. The phpdoc needs to be updated to mention the new 'all' value. |
Updated in 35aa672 |
|
I added some unit tests with assistance from Claude Code in d556331 |
|
@adamsilverstein, do you mind adding the We could copy the following test and adapt it for wordpress-develop/tests/phpunit/tests/rest-api/rest-comments-controller.php Lines 1159 to 1181 in ceae14b
|
Will do! |
I tried adding this test, but it fails: the response does not include the |
I was able to fix the test failures which I believe are legitimate with this commit: f980a6c I'm going to cherry pick the test and fix to a new PR since it is a separate issue |
Will open matching Trac ticket |
|
I'm wondering if it's worth introducing a meta capability for case 'read_comment':
if ( ! isset( $args[0] ) ) {
/* translators: %s: Capability name. */
$message = __( 'When checking for the %s capability, you must always check it against a specific comment.' );
_doing_it_wrong(
__FUNCTION__,
sprintf( $message, '<code>' . $cap . '</code>' ),
'6.9.0'
);
$caps[] = 'do_not_allow';
break;
}
$comment = get_comment( $args[0] );
if ( ! $comment ) {
$caps[] = 'do_not_allow';
break;
}
$comment_type = get_comment_type( $comment );
$post_id = $comment->comment_post_ID;
if ( 'note' === $comment_type ) {
// Comment is a note, requires edit_post capability.
$caps = map_meta_cap( 'edit_post', $user_id, $post_id );
}
break; |
| array( | ||
| 'count' => true, | ||
| 'orderby' => 'none', | ||
| 'type' => 'all', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: before this change, not passing a type implied 'all'
@peterwilsoncc that sounds great, can we work on it in a separate PR as it feels unrelated to the current change? |
@TimothyBJacobs I updated the docblock, thanks for reviewing. |
westonruter
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, although I don't have all of the context.
|
@adamsilverstein, do you mind including the fix from WordPress/gutenberg#72561? Otherwise, the returned |
Yes, I will work on adding that! |
Added in 63e391d. I am going to add a test for this. |
Added a test that verifies the query parameters are present in the children href in 5c08331 I also validated the fix using the testing instructions in WordPress/gutenberg#72561 |
|
@Mamaduka can you please review the additional changes and test for children embedding? then I can get this committed. |
Mamaduka
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @adamsilverstein!
I left one note regarding tests, but the children backport looks good.
Trac ticket: https://core.trac.wordpress.org/ticket/64145
Also fixes: https://core.trac.wordpress.org/ticket/64152
Fixes WordPress/gutenberg#72548.
Fixes WordPress/gutenberg#72607.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.