Skip to content

Commit

Permalink
Use dashes instead of underscores for consistency with other actions (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbachhuber authored Oct 4, 2018
1 parent 10e8751 commit fce0317
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ function gutenberg_add_target_schema_to_links( $response, $post, $request ) {
$post_type = get_post_type_object( $post->post_type );
$orig_href = ! empty( $orig_links['self'][0]['href'] ) ? $orig_links['self'][0]['href'] : null;
if ( 'edit' === $request['context'] && current_user_can( 'unfiltered_html' ) ) {
$new_links['https://api.w.org/action-unfiltered_html'] = array(
$new_links['https://api.w.org/action-unfiltered-html'] = array(
array(
'title' => __( 'The current user can post HTML markup and JavaScript.', 'gutenberg' ),
'href' => $orig_href,
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -1952,7 +1952,7 @@ export function getTokenSettings( state, name ) {
* @return {boolean} Whether the user can or can't post unfiltered HTML.
*/
export function canUserUseUnfilteredHTML( state ) {
return has( getCurrentPost( state ), [ '_links', 'wp:action-unfiltered_html' ] );
return has( getCurrentPost( state ), [ '_links', 'wp:action-unfiltered-html' ] );
}

/**
Expand Down
6 changes: 3 additions & 3 deletions packages/editor/src/store/test/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -4158,17 +4158,17 @@ describe( 'selectors', () => {
} );

describe( 'canUserUseUnfilteredHTML', () => {
it( 'should return true if the _links object contains the property wp:action-unfiltered_html', () => {
it( 'should return true if the _links object contains the property wp:action-unfiltered-html', () => {
const state = {
currentPost: {
_links: {
'wp:action-unfiltered_html': [],
'wp:action-unfiltered-html': [],
},
},
};
expect( canUserUseUnfilteredHTML( state ) ).toBe( true );
} );
it( 'should return false if the _links object doesnt contain the property wp:action-unfiltered_html', () => {
it( 'should return false if the _links object doesnt contain the property wp:action-unfiltered-html', () => {
const state = {
currentPost: {
_links: {},
Expand Down
2 changes: 1 addition & 1 deletion phpunit/class-gutenberg-rest-api-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function test_viewable_field_without_context() {
*/
function test_link_unfiltered_html() {
$post_id = $this->factory->post->create();
$check_key = 'https://api.w.org/action-unfiltered_html';
$check_key = 'https://api.w.org/action-unfiltered-html';
// admins can in a single site, but can't in a multisite.
wp_set_current_user( $this->administrator );
$request = new WP_REST_Request( 'GET', '/wp/v2/posts/' . $post_id );
Expand Down

0 comments on commit fce0317

Please sign in to comment.