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

Publish Button: Submit for review as pending for contributor #2526

Merged
merged 1 commit into from Aug 28, 2017

Conversation

aduth
Copy link
Member

@aduth aduth commented Aug 24, 2017

Closes #2029
Closes #2547

This pull request seeks to account for user capability in deciding the behavior of the Publish button. Specifically, if a user is not capable of publishing posts, they must Submit for Review instead, flagging the post as Pending.

Testing instructions:

  1. Navigate to the post editor
  2. Note that...
    • If your current user has ability to publish posts, the Publish button shows as Publish
    • Otherwise, the Publish button shows as Submit for Review

The "Submit for Review" label should take priority over all other scenarios, including updating an existing post and setting a post into the future.

@aduth aduth added the General Interface Parts of the UI which don't fall neatly under other labels. label Aug 24, 2017
@codecov
Copy link

codecov bot commented Aug 24, 2017

Codecov Report

Merging #2526 into master will increase coverage by 0.44%.
The diff coverage is 92.3%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2526      +/-   ##
==========================================
+ Coverage    30.2%   30.65%   +0.44%     
==========================================
  Files         174      174              
  Lines        5270     5268       -2     
  Branches      900      902       +2     
==========================================
+ Hits         1592     1615      +23     
+ Misses       3121     3102      -19     
+ Partials      557      551       -6
Impacted Files Coverage Δ
editor/header/tools/publish-button.js 88.46% <92.3%> (+88.46%) ⬆️

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 5f0fe6f...30c2a73. Read the comment docs.

@@ -0,0 +1,203 @@
/**
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks a lot for these tests, these are very useful.

),
withAPIData( () => {
return {
user: '/wp/v2/users/me?context=edit',
Copy link
Contributor

Choose a reason for hiding this comment

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

The context edit is awesome :). Seems like a hidden feature

Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

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

Works great for me!

I don't know if we want a special notice for this, or if the "saved" status is enough.

@aduth aduth force-pushed the update/user-publish-capabilities branch from 0c31935 to 30c2a73 Compare August 27, 2017 23:41
@aduth
Copy link
Member Author

aduth commented Aug 27, 2017

I don't know if we want a special notice for this, or if the "saved" status is enough.

Yeah, we should probably want some messaging. The current editor shows a "Post submitted" after submitting for review. We can do similarly in the effects for publishing a post, but we'll want to think through ramifications of considering "pending" as a published state.

const publishStatus = [ 'publish', 'private', 'future' ];
const isPublished = publishStatus.indexOf( previousPost.status ) !== -1;
const messages = {
publish: __( 'Post published!' ),
private: __( 'Post published privately!' ),
future: __( 'Post scheduled!' ),
};

I'll plan to create a separate issue.

@aduth aduth merged commit 9fed9d1 into master Aug 28, 2017
@aduth aduth deleted the update/user-publish-capabilities branch August 28, 2017 00:27
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.

None yet

2 participants