Skip to content
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

Use dashes instead of underscores for consistency with other actions #10256

Merged
merged 1 commit into from
Oct 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,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 @@ -1929,7 +1929,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 @@ -4080,17 +4080,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