Skip to content

Fix submit for review button#10941

Merged
oandregal merged 27 commits into
masterfrom
fix/submit-for-review
Oct 25, 2018
Merged

Fix submit for review button#10941
oandregal merged 27 commits into
masterfrom
fix/submit-for-review

Conversation

@oandregal

@oandregal oandregal commented Oct 23, 2018

Copy link
Copy Markdown
Member

Fixes #10475

This PR takes the viewport size into account when it comes to decide whether we show the button or toggle logic. Here's how this PR modifies the logic (changes in bold):

Logic Before After
Post status is publish or private Button Button
Post status is future and the (scheduled) date is after now Button Button
Post status is pending, cannot be published and the viewport is < medium Button Toggle
Post status is pending, cannot be published and the viewport >= medium Button Button
Publish sidebar is enabled Toggle Toggle
Publish sidebar is disabled and viewport is < medium Button Toggle
Publish sidebar is disabled and viewport is >= medium Button Button

TODO

  • Show the "Publish..." button below medium viewports overriding the pre-publish checks option if necessary.
  • Hide pre-publish checks option on the general settings modal below medium viewports.
  • Update/Add e2e tests.

@oandregal oandregal self-assigned this Oct 23, 2018
@oandregal oandregal added [Type] Bug An existing feature does not function as intended [Type] Regression Related to a regression in the latest release labels Oct 23, 2018
@oandregal oandregal added this to the 4.2 milestone Oct 23, 2018
@oandregal oandregal added the [Status] In Progress Tracking issues with work in progress label Oct 23, 2018
@oandregal oandregal requested review from a team and jasmussen October 23, 2018 10:35
@oandregal oandregal changed the title Fix/submit for review Fix/submit for review button on small viewports Oct 23, 2018
@oandregal oandregal changed the title Fix/submit for review button on small viewports Fix submit for review button on small viewports Oct 23, 2018
@jasmussen

Copy link
Copy Markdown
Contributor

Hmm am I doing something wrong?

I have unchecked prepublish checks, but they're still not present on mobile:

screen shot 2018-10-23 at 12 55 14

@oandregal

Copy link
Copy Markdown
Member Author

Hmm am I doing something wrong?

Testing before this is ready! 😄

I'm still working on this. I should have waited before pinging you as a reviewer.

@jasmussen

Copy link
Copy Markdown
Contributor

No worries. I'll keep an eye on this!

@oandregal oandregal changed the title Fix submit for review button on small viewports Fix submit for review button Oct 23, 2018
@oandregal

Copy link
Copy Markdown
Member Author

@jasmussen @WordPress/gutenberg-core this is ready for review. I still need to get ready the e2e tests, but wanted to give folks as much time as possible for review. Need to be away a couple of hours but will come back to this by the end of the day.

@oandregal oandregal removed the [Status] In Progress Tracking issues with work in progress label Oct 23, 2018
@jasmussen

Copy link
Copy Markdown
Contributor

This is excellent. I can confirm this works as intended 👍 👍

This should go right in once the e2e tests are fixed. Am I correct in thinking this replaces #10803? If so we should thank @nfmohit-wpmudev for his work so far, and his inspiration for this.

@oandregal

Copy link
Copy Markdown
Member Author

Added some basic e2e tests in c7b89a2.

@noisysocks noisysocks left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This works in my testing and is looking really good! Great work 💯📈🎉

I left a few notes on how I think we could make the code a little easier to understand.

Comment thread packages/edit-post/src/components/header/index.js Outdated
Comment thread test/e2e/specs/publishing.test.js Outdated
Comment thread packages/edit-post/src/components/options-modal/options.js Outdated
Comment thread packages/edit-post/src/components/header/index.js Outdated
@oandregal

Copy link
Copy Markdown
Member Author

@noisysocks done a refactoring to clarify the button or toggle logic, as you suggested. Also added a bunch of unit tests. Everything is much clearer now! Added a table to the PR description with the changes and some code comments to add further context to our futureselves.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This was a leftover, wasn't being used.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I've noticed we're selecting stuff that we don't need all over the place. I wonder if we could somehow write a lint rule to catch them all...

Some languages such as Deustch have longer text that need acomodation.
We are also using medium to hide the writing modes,
so it makes sense to follow that.
We want to show the "Publish..." button on < medium viewports,
no matter what the isPublishSidebarEnabled state is.
@oandregal oandregal force-pushed the fix/submit-for-review branch from 53615dd to b94538d Compare October 24, 2018 11:48

@noisysocks noisysocks left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes! Love it! This is a lot easier to follow. Thanks also for documenting the logic both in the code and in the PR. Gold star for you ⭐️

There were some minor indentation issues in post-publish-button-or-toggle.js. I fixed them up by running Prettier on the file in f4aed3d. Hope you don't mind!

@oandregal oandregal merged commit 8ce47cb into master Oct 25, 2018
@oandregal oandregal deleted the fix/submit-for-review branch October 25, 2018 07:31
@oandregal

Copy link
Copy Markdown
Member Author

Thanks for f4aed3d, Robert!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Bug An existing feature does not function as intended [Type] Regression Related to a regression in the latest release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants