-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Global styles revisions: ensure the revisions endpoint permissions match the global styles controller #50270
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -265,10 +265,13 @@ public function get_item_permissions_check( $request ) { | |
return $post; | ||
} | ||
|
||
/* | ||
* The same check as WP_REST_Global_Styles_Controller->get_item_permissions_check. | ||
*/ | ||
if ( ! current_user_can( 'read_post', $post->ID ) ) { | ||
return new WP_Error( | ||
'rest_cannot_view', | ||
__( 'Sorry, you are not allowed to view revisions for this global style.', 'gutenberg' ), | ||
__( 'Sorry, you are not allowed to view this global style.', 'gutenberg' ), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just double-checking, the only intended change in this PR is the wording on this line + adding tests? In the other PR it looks like a different check was being used. In this case, the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry 🤦 The intention was to ensure the check was exactly the same as WP_REST_Global_Styles_Controller and I copied the translation over as well. That means the only purpose of this PR is to add 1 x comment and add a test. Thanks @andrewserong There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All good, thanks for clarifying! 🙂 |
||
array( 'status' => rest_authorization_required_code() ) | ||
); | ||
} | ||
|
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.
Adding comment for context.