REST API: Merge two similar permission error strings in `class-wp-rest-comments-controller.php`.

We're checking if `current_user_can( 'moderate_comments' )` here, not the specific comment permissions.

See #38857.

git-svn-id: https://develop.svn.wordpress.org/trunk@39305 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2016-11-19 00:09:07 +00:00
parent d087812e08
commit b61f722856
1 changed files with 1 additions and 1 deletions

View File

@ -320,7 +320,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
} }
if ( ! empty( $request['context'] ) && 'edit' === $request['context'] && ! current_user_can( 'moderate_comments' ) ) { if ( ! empty( $request['context'] ) && 'edit' === $request['context'] && ! current_user_can( 'moderate_comments' ) ) {
return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to view this comment with edit context.' ), array( 'status' => rest_authorization_required_code() ) ); return new WP_Error( 'rest_forbidden_context', __( 'Sorry, you are not allowed to view comments with edit context.' ), array( 'status' => rest_authorization_required_code() ) );
} }
return true; return true;