Skip to content
This repository has been archived by the owner on Apr 4, 2020. It is now read-only.

Added: Comment Meta Endpoints #7

Merged
merged 5 commits into from
Feb 26, 2016

Conversation

kjbenk
Copy link
Contributor

@kjbenk kjbenk commented Feb 24, 2016

This PR adds the comment meta endpoints based on the issue #1.

return new WP_Error( 'rest_comment_invalid_id', __( 'Invalid comment id.' ), array( 'status' => 404 ) );
}

if ( ! current_user_can( 'moderate_comments', $comment->comment_ID ) ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moderate_comments doesn't accept a second param.

@danielbachhuber danielbachhuber added this to the 0.2.0 milestone Feb 25, 2016
@danielbachhuber
Copy link
Member

@kjbenk Can you resolve the merge conflict, and address the two minor comments?

* REMOVED: ‘moderate_comments’ does not accept a second parameter
* REMOVED: wp_set_current_user($this->admin_id); not needed for some
unit tests
@kjbenk
Copy link
Contributor Author

kjbenk commented Feb 26, 2016

@danielbachhuber Ready to merge.

return new WP_Error( 'rest_comment_invalid_id', __( 'Invalid comment id.' ), array( 'status' => 404 ) );
}

if ( ! current_user_can( 'moderate_comments' ) ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I'd think this check should be edit_comment again, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe since the edit_comment cap is used when trying to delete a comment anyways.

https://github.com/WordPress/WordPress/blob/06225cc394ee72035b3afa6ef380b847f1e98912/wp-admin/comment.php#L89

* UPDATED: The `delete_item_permissions_check` function now uses the
`edit_comment` cap instead of the `moderate_comments` cap
@kjbenk
Copy link
Contributor Author

kjbenk commented Feb 26, 2016

@danielbachhuber have a look now.

danielbachhuber added a commit that referenced this pull request Feb 26, 2016
@danielbachhuber danielbachhuber merged commit 44a9e07 into WP-API:master Feb 26, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants