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

Chrome: Adding a post author dropdown #2100

Merged
merged 2 commits into from
Aug 2, 2017
Merged

Conversation

youknowriad
Copy link
Contributor

closes #968

A simple PR adding a select allowing us to select the post author dropdown in case the "user" request for authors, editors and administrators returns more than one result.

@youknowriad youknowriad added the General Interface Parts of the UI which don't fall neatly under other labels. label Jul 31, 2017
@youknowriad youknowriad self-assigned this Jul 31, 2017
@youknowriad youknowriad requested review from jasmussen and aduth July 31, 2017 08:56
@codecov
Copy link

codecov bot commented Jul 31, 2017

Codecov Report

Merging #2100 into master will decrease coverage by 0.1%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2100      +/-   ##
==========================================
- Coverage   20.25%   20.14%   -0.11%     
==========================================
  Files         135      136       +1     
  Lines        4227     4503     +276     
  Branches      718      801      +83     
==========================================
+ Hits          856      907      +51     
- Misses       2842     2987     +145     
- Partials      529      609      +80
Impacted Files Coverage Δ
editor/sidebar/post-author/index.js 0% <0%> (ø)
editor/sidebar/post-status/index.js 0% <0%> (ø) ⬆️
blocks/block-alignment-toolbar/index.js 30% <0%> (-10%) ⬇️
editor/state.js 92.3% <0%> (-0.31%) ⬇️
blocks/url-input/index.js 0% <0%> (ø) ⬆️
editor/index.js 0% <0%> (ø) ⬆️
components/icon-button/index.js 100% <0%> (ø) ⬆️
components/dropdown-menu/index.js 0% <0%> (ø) ⬆️
editor/sidebar/block-inspector/class-name.js 0% <0%> (ø) ⬆️
editor/sidebar/post-visibility/index.js 0% <0%> (ø) ⬆️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 39f459f...41a0f85. Read the comment docs.

@jasmussen
Copy link
Contributor

Looks good!

Can you add a margin: -5px 0; to the dropdown in the author panel, so the spacing between component panels gets normalized?

screen shot 2017-07-31 at 11 26 54

If yes, then ship!

@paulwilde
Copy link
Contributor

paulwilde commented Jul 31, 2017

My only concern is the placement. It adds further vertical space onto the already quite lengthy publish box, and its likely a setting which is hardly ever changed.

Funnily enough I actually submitted a patch for core 2 years ago that removes the author meta box and puts the option into the publish meta box. However in hindsight I agree with the reason for it not being considered.

@youknowriad youknowriad force-pushed the add/author-dropdown branch from 58d5b9f to 619de3b Compare July 31, 2017 09:56
@youknowriad
Copy link
Contributor Author

Styling fixed.

@paulwilde valid concern, there are two designs proposed in the issue and it seemed that the current one has the majority votes. Happy to change it to whichever other option we choose. But maybe we should get this is as a start.

@jasmussen
Copy link
Contributor

It's a good thought, but worth noting that the dialog itself only shows up if there's more than one author on the site.

aduth
aduth previously requested changes Jul 31, 2017
}

componentWillUnmount() {
if ( this.fetchAuthorsRequest ) {
Copy link
Member

Choose a reason for hiding this comment

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

I notice in some cases (latest posts, for example) we're checking the status as pending before deciding to abort. If the object let's us call abort anyways, and this property is always defined, maybe we don't need the condition at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right! we probably don't need this condition.


componentWillUnmount() {
if ( this.fetchAuthorsRequest ) {
return this.fetchAuthorsRequest.abort();
Copy link
Member

Choose a reason for hiding this comment

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

Why return ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

mistake


fetchAuthors() {
this.fetchAuthorsRequest = new wp.api.collections.Users().fetch( { data: {
roles: 'author,editor,administrator',
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to define roles here? Two issues

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question and I answer with another question: Is is ok to set a "subscriber" as a post author?

Copy link
Member

Choose a reason for hiding this comment

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

Good question and I answer with another question: Is is ok to set a "subscriber" as a post author?

Sorry, I had been thinking about this the other day and meant to respond: We should request users by capability, not role. Specifically the edit_posts capability. This is not currently supported by the list endpoint, however. Probably an API task worth exploring. I'll create an issue.

@youknowriad youknowriad dismissed aduth’s stale review August 1, 2017 09:02

Dropped the role filter, it looks like we can assign a post to a subscriber

@youknowriad
Copy link
Contributor Author

I'd appreciate another look here before merging.

@jasmussen
Copy link
Contributor

I think this looks great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
General Interface Parts of the UI which don't fall neatly under other labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI: Add author dropdown
4 participants