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 wp:action-assign-author to indicate if user can assign authors #6630

Merged
merged 2 commits into from
May 9, 2018

Conversation

danielbachhuber
Copy link
Member

Description

Introduces a wp:action-assign-author action (see conversation in #6529) to indicate whether the current user can assign authors.

See #6361
Fixes #3010

How has this been tested?

As a WordPress user with role author, I cannot modify the post author:

image

However, I can modify the post author as a WordPress user with role editor:

image

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.

@danielbachhuber danielbachhuber added this to the 2.9 milestone May 7, 2018
@danielbachhuber danielbachhuber requested a review from a team May 7, 2018 23:45
return {
hasAssignAuthorAction: get( post, [ '_links', 'wp:action-assign-author' ], false ),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realised I forgot to comment on this in #6529. I think it'd be useful to create a selector for retrieving this data. Something like select( 'core/editor' ).getPostLink( 'wp:action-assign-author' ), or maybe select( 'core/editor' ).getPostActionFlag( 'assign-author' ). Neither of those names are good, but you get the idea.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, I've opened an issue for this #6655

lib/rest-api.php Outdated
if ( current_user_can( $post_type->cap->edit_others_posts ) ) {
$new_links['https://api.w.org/action-assign-author'] = array(
array(
'title' => __( 'The current user change author on this post.', 'gutenberg' ),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little grammar tweak: 'The current user can change the author on this post.'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in b13fe80

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants