-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Globals Styles Endpoint: Declare edit_css capability in links #3889
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
Changes from all 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 |
|---|---|---|
|
|
@@ -513,4 +513,23 @@ public function test_get_theme_items() { | |
| ); | ||
| $this->assertSameSetsWithIndex( $data, $expected ); | ||
| } | ||
|
|
||
| /** | ||
| * @covers WP_REST_Global_Styles_Controller::get_available_actions | ||
| */ | ||
| public function test_assign_edit_css_action_admin() { | ||
| wp_set_current_user( self::$admin_id ); | ||
|
|
||
| $request = new WP_REST_Request( 'GET', '/wp/v2/global-styles/' . self::$global_styles_id ); | ||
| $request->set_param( 'context', 'edit' ); | ||
| $response = rest_do_request( $request ); | ||
| $links = $response->get_links(); | ||
|
|
||
| // Admins can only edit css on single site. | ||
| if ( is_multisite() ) { | ||
| $this->assertArrayNotHasKey( 'https://api.w.org/action-edit-css', $links ); | ||
| } else { | ||
| $this->assertArrayHasKey( 'https://api.w.org/action-edit-css', $links ); | ||
| } | ||
| } | ||
|
Comment on lines
+520
to
+534
Member
Author
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. I used the post-controller tests as a blueprint here https://github.com/WordPress/wordpress-develop/blob/6.1/tests/phpunit/tests/rest-api/rest-posts-controller.php#L4903-L4918.
Contributor
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. Good job @Mamaduka 👏 |
||
| } | ||
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.
There's an unanswered question from the Gutenberg PR
Pinging @TimothyBJacobs @spacedmonkey for review.
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.
All similar action URLs lead to a 404 page -
https://api.wordpress.org/action-unfiltered-html.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.
@TimothyBJacobs, @spacedmonkey, can you confirm that it's okay to use this URL?
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.
Sorry for missing this the first time round. The URLs don't actually point anywhere. That URL is fine to use.
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, @TimothyBJacobs!