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

Delay private publish #12023

Closed
wants to merge 11 commits into from
Closed

Delay private publish #12023

wants to merge 11 commits into from

Conversation

earnjam
Copy link
Contributor

@earnjam earnjam commented Nov 17, 2018

Update: This PR no longer changes the verbiage on the Publish button per feedback. See updates below for most recent details.

Description

This is an approach to setting private visibility that doesn't immediately publish the post. Instead it changes the verbiage on the publish button and disables the save draft button, allowing a user to continue working on the post before going live.

Fixes #9396

Screenshots

With the pre-publish panel

private-publish-prompt

With immediate publish

immediate-private-publish

Copy link
Member

@jorgefilipecosta jorgefilipecosta left a comment

Choose a reason for hiding this comment

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

Hi @earnjam,

I'm noticing a bug in this branch:
Create a new post, write a time, random content.
Set a publish date for the future.
Set visibility to private.
Press schedule and finish the process.
Reload the post and now the post visibility is set to public.

@earnjam
Copy link
Contributor Author

earnjam commented Nov 19, 2018

Thanks for catching that @jorgefilipecosta

In the classic editor, if you set post visibility to private, then the post date didn't matter. It was live for any logged in user, and hidden (returns a 404) for any non-logged in user. This makes sense because all scheduled posts are visible for logged in users. So scheduling doesn't matter if it's private, but we should just make sure to account for the date when transitioning from private to public.

I'll update the branch so that private takes priority over future when setting post status. The opposite is true in this PR currently.

@gziolo
Copy link
Member

gziolo commented Feb 5, 2019

@earnjam - do you have any plans to update this patch to address feedback from @jorgefilipecosta and ensure that code is refreshed to use all the latest changes from master branch? We could include it in the next Gutenberg 5.1 release when it's ready.

@gziolo gziolo added the Backwards Compatibility Issues or PRs that impact backwards compatability label Feb 5, 2019
@earnjam
Copy link
Contributor Author

earnjam commented Feb 5, 2019

Yes, I should have some time tomorrow to work on it. When are we planning to release Gutenberg 5.1?

@gziolo
Copy link
Member

gziolo commented Feb 5, 2019

In two weeks.

@earnjam
Copy link
Contributor Author

earnjam commented Feb 14, 2019

I rebased master and fixed the issues with scheduled vs private and the associated labeling. Should be good for review now.

@youknowriad youknowriad added the Needs Design Feedback Needs general design feedback. label Feb 14, 2019
@youknowriad
Copy link
Contributor

youknowriad commented Feb 14, 2019

Thanks for the update @earnjam

Added a "Needs design feedback" label. This PR changes the flows a little bit and to be honest, whenever we touch these buttons and anything related to "post status", I freak out as it's very delicate, it affects (scheduling, autosaves, metaboxes,dirty checking...).

Let's get some design eyes and if it's a good direction, let's make sure we test this PR properly.

@youknowriad youknowriad removed this from the 5.3 (Gutenberg) milestone Mar 18, 2019
@mapk
Copy link
Contributor

mapk commented Apr 5, 2019

Hey @earnjam I'm sorry no one has provided a design review. I'd like to provide one, but can't get this PR running locally. Can you rebase it?

I prefer the pre-publish panel to stay inline with the current publish flow. Thanks!

Copy link
Member

@aduth aduth left a comment

Choose a reason for hiding this comment

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

If I recall correctly the challenges around setting private visibility without publishing, I would have expected to see some more changes here to the underlying data mechanics of considering a post as "saveable" (e.g. isEditedPostSaveable). Otherwise, I suspect the autosave mechanic could still save the post in an unintended state? Likewise for Cmd+S ? It seems this should be forbidden at the data flow (the savePost action), not just hidden from the interface.

@sarahmonster
Copy link
Member

Hi @earnjam! I'm trying to test this branch locally but I'm running into some errors:

getInsertUsage@http://localhost:8888/wp-content/plugins/gutenberg/build/editor/index.js?ver=1556206494:38503:3
buildBlockTypeInserterItem@http://localhost:8888/wp-content/plugins/gutenberg/build/editor/index.js?ver=1556206494:38652:16
./packages/editor/build-module/store/selectors.js/getInserterItems<@http://localhost:8888/wp-content/plugins/gutenberg/build/editor/index.js?ver=1556206494:38702:6
callSelector@http://localhost:8888/wp-content/plugins/gutenberg/build/editor/index.js?ver=1556206494:6277:18
runSelector@http://localhost:8888/wp-content/plugins/gutenberg/build/data/index.js?ver=1556206494:2420:23
./packages/editor/build-module/components/inserter-with-shortcuts/index.js/__webpack_exports__.default<@http://localhost:8888/wp-content/plugins/gutenberg/build/editor/index.js?ver=1556206494:18158:12
getNextMergeProps@http://localhost:8888/wp-content/plugins/gutenberg/build/data/index.js?ver=1556206494:1983:14
ComponentWithSelect@http://localhost:8888/wp-content/plugins/gutenberg/build/data/index.js?ver=1556206494:2001:28
zf@http://localhost:8888/wp-content/plugins/gutenberg/vendor/react-dom.min.713f0afa.js:69:258
Mf@http://localhost:8888/wp-content/plugins/gutenberg/vendor/react-dom.min.713f0afa.js:87:4
ph@http://localhost:8888/wp-content/plugins/gutenberg/vendor/react-dom.min.713f0afa.js:98:474
eg@http://localhost:8888/wp-content/plugins/gutenberg/vendor/react-dom.min.713f0afa.js:125:307
fg@http://localhost:8888/wp-content/plugins/gutenberg/vendor/react-dom.min.713f0afa.js:126:168
wc@http://localhost:8888/wp-content/plugins/gutenberg/vendor/react-dom.min.713f0afa.js:138:237
fa@http://localhost:8888/wp-content/plugins/gutenberg/vendor/react-dom.min.713f0afa.js:137:115
lg@http://localhost:8888/wp-content/plugins/gutenberg/vendor/react-dom.min.713f0afa.js:148:342
re@http://localhost:8888/wp-content/plugins/gutenberg/vendor/react-dom.min.713f0afa.js:23:322
Xb@http://localhost:8888/wp-content/plugins/gutenberg/vendor/react-dom.min.713f0afa.js:40:304

Other than that (not sure it's related, I seem to be finding all the strange errors of late) this feels like a better solution than the current setup where selecting private visibility immediately publishes the post. 😱

One thing I noticed whilst testing is that there's some inconsistency in the way the three different visibility options behave:

2019-04-25 09 39 57

Public sets the publish button text to "publish", and the status to "public".
Private sets the publish button text to "publish privately", and the status to "private".
*Password protected sets the publish button text to "publish", and the status to "password protected".

To increase consistency here, I'd recommend either:

a) Keeping the text of the publish button consistent, regardless of visibility settings.
b) Changing the text of the publish button when publishing a password-protected post.

My instinct is to opt for a) here, especially since the visibility is then reiterated in the pre-publish panel, which is going to be redesigned a bit to aid in user certain when publishing (see #7602 for more), but I'd love additional feedback from a user experience perspective.

@earnjam
Copy link
Contributor Author

earnjam commented Apr 25, 2019

@sarahmonster I last updated this PR ~2 months ago, so I wouldn't be surprised if has new issues by now. I'll take a look at it.

@earnjam
Copy link
Contributor Author

earnjam commented Apr 25, 2019

@aduth I'll look more closely at it to confirm, but since the autosave mechanic should only be saving revisions, it seems like it would be unaffected by this.

I suppose for a new post that has yet to be published, autosave updates the original post, which has a status of auto-draft, so perhaps there is a risk there that the autosave mechanic would change that status to private?

@github-actions
Copy link

Size Change: +13 B (0%)

Total Size: 856 kB

Filename Size Change
build/editor/index.js 43.8 kB +13 B (0%)
ℹ️ View Unchanged
Filename Size Change
build/a11y/index.js 1.01 kB 0 B
build/annotations/index.js 3.43 kB 0 B
build/api-fetch/index.js 3.39 kB 0 B
build/autop/index.js 2.58 kB 0 B
build/blob/index.js 620 B 0 B
build/block-directory/index.js 6.02 kB 0 B
build/block-directory/style-rtl.css 760 B 0 B
build/block-directory/style.css 760 B 0 B
build/block-editor/index.js 100 kB 0 B
build/block-editor/style-rtl.css 10.7 kB 0 B
build/block-editor/style.css 10.7 kB 0 B
build/block-library/editor-rtl.css 7.23 kB 0 B
build/block-library/editor.css 7.24 kB 0 B
build/block-library/index.js 111 kB 0 B
build/block-library/style-rtl.css 7.38 kB 0 B
build/block-library/style.css 7.39 kB 0 B
build/block-library/theme-rtl.css 669 B 0 B
build/block-library/theme.css 671 B 0 B
build/block-serialization-default-parser/index.js 1.65 kB 0 B
build/block-serialization-spec-parser/index.js 3.1 kB 0 B
build/blocks/index.js 57.7 kB 0 B
build/components/index.js 191 kB 0 B
build/components/style-rtl.css 15.5 kB 0 B
build/components/style.css 15.5 kB 0 B
build/compose/index.js 5.76 kB 0 B
build/core-data/index.js 10.6 kB 0 B
build/data-controls/index.js 1.04 kB 0 B
build/data/index.js 8.21 kB 0 B
build/date/index.js 5.37 kB 0 B
build/deprecated/index.js 772 B 0 B
build/dom-ready/index.js 568 B 0 B
build/dom/index.js 3.06 kB 0 B
build/edit-post/index.js 91.3 kB 0 B
build/edit-post/style-rtl.css 8.64 kB 0 B
build/edit-post/style.css 8.64 kB 0 B
build/edit-site/index.js 4.64 kB 0 B
build/edit-site/style-rtl.css 2.48 kB 0 B
build/edit-site/style.css 2.48 kB 0 B
build/edit-widgets/index.js 4.45 kB 0 B
build/edit-widgets/style-rtl.css 2.58 kB 0 B
build/edit-widgets/style.css 2.58 kB 0 B
build/editor/editor-styles-rtl.css 381 B 0 B
build/editor/editor-styles.css 382 B 0 B
build/editor/style-rtl.css 3.97 kB 0 B
build/editor/style.css 3.96 kB 0 B
build/element/index.js 4.45 kB 0 B
build/escape-html/index.js 733 B 0 B
build/format-library/index.js 7.09 kB 0 B
build/format-library/style-rtl.css 502 B 0 B
build/format-library/style.css 502 B 0 B
build/hooks/index.js 1.92 kB 0 B
build/html-entities/index.js 621 B 0 B
build/i18n/index.js 3.49 kB 0 B
build/is-shallow-equal/index.js 710 B 0 B
build/keyboard-shortcuts/index.js 2.3 kB 0 B
build/keycodes/index.js 1.68 kB 0 B
build/list-reusable-blocks/index.js 2.99 kB 0 B
build/list-reusable-blocks/style-rtl.css 226 B 0 B
build/list-reusable-blocks/style.css 226 B 0 B
build/media-utils/index.js 4.85 kB 0 B
build/notices/index.js 1.57 kB 0 B
build/nux/index.js 3.01 kB 0 B
build/nux/style-rtl.css 616 B 0 B
build/nux/style.css 613 B 0 B
build/plugins/index.js 2.54 kB 0 B
build/primitives/index.js 1.49 kB 0 B
build/priority-queue/index.js 779 B 0 B
build/redux-routine/index.js 2.84 kB 0 B
build/rich-text/index.js 14.3 kB 0 B
build/server-side-render/index.js 2.55 kB 0 B
build/shortcode/index.js 1.7 kB 0 B
build/token-list/index.js 1.27 kB 0 B
build/url/index.js 4.01 kB 0 B
build/viewport/index.js 1.61 kB 0 B
build/warning/index.js 1.14 kB 0 B
build/wordcount/index.js 1.18 kB 0 B

compressed-size-action

@earnjam
Copy link
Contributor Author

earnjam commented Mar 13, 2020

I've rebased master onto this branch and updated. It's got a couple of failed e2e tests that I think just need to be updated to reflect some UI changes. I'll fix those this morning, but it would be good to get design/UX feedback on this, because that's still the major holdup.

I'd lean more toward reverting to the classic editor visibility workflow in the short term, which has been around for many years and is an improvement on the status quo

Can you provide an example of this flow, @earnjam? If this is something you can rework in this PR and it fixes the a11y issue, let's try it out.

@mapk The flow in this PR is essentially the flow from the classic editor.

Quick highlights:

  • You can set to private and continue working on the post until you're ready to publish.
  • The post is considered dirty with that change, so if you navigate away after switching, it will warn you.
  • The save draft button is hidden on switching to private because you can't have a private draft. (private is a non-draft status similar to published)
  • Once the private post is "published", the switch to draft button returns, allowing you to "unpublish"

I think the remaining question is one I posed earlier in the thread, about how to handle the switch back to draft after "publishing" the private post. It will kick the visibility back to public because you can't have a private draft. (Both are stored in post_status. Draft is basically the same thing as private but with the possibility of a floating date. Private must have a date set.) Is that too confusing?

Should we add a snackbar notice or something similar to make that more obvious that it has occurred? It's possible a user might switch a published private post to a draft, then publish again not realizing that it had changed to public.

@github-actions
Copy link

Size Change: +597 B (0%)

Total Size: 856 kB

Filename Size Change
build/block-directory/index.js 6.03 kB +1 B
build/block-library/index.js 111 kB -1 B
build/components/index.js 191 kB -258 B (0%)
build/components/style-rtl.css 15.7 kB +217 B (1%)
build/components/style.css 15.7 kB +218 B (1%)
build/compose/index.js 6.22 kB +461 B (7%) 🔍
build/edit-post/index.js 91.3 kB +25 B (0%)
build/edit-post/style-rtl.css 8.62 kB -22 B (0%)
build/edit-post/style.css 8.62 kB -25 B (0%)
build/editor/index.js 43.8 kB -19 B (0%)
ℹ️ View Unchanged
Filename Size Change
build/a11y/index.js 1.01 kB 0 B
build/annotations/index.js 3.43 kB 0 B
build/api-fetch/index.js 3.39 kB 0 B
build/autop/index.js 2.58 kB 0 B
build/blob/index.js 620 B 0 B
build/block-directory/style-rtl.css 760 B 0 B
build/block-directory/style.css 760 B 0 B
build/block-editor/index.js 100 kB 0 B
build/block-editor/style-rtl.css 10.7 kB 0 B
build/block-editor/style.css 10.7 kB 0 B
build/block-library/editor-rtl.css 7.23 kB 0 B
build/block-library/editor.css 7.24 kB 0 B
build/block-library/style-rtl.css 7.38 kB 0 B
build/block-library/style.css 7.39 kB 0 B
build/block-library/theme-rtl.css 669 B 0 B
build/block-library/theme.css 671 B 0 B
build/block-serialization-default-parser/index.js 1.65 kB 0 B
build/block-serialization-spec-parser/index.js 3.1 kB 0 B
build/blocks/index.js 57.7 kB 0 B
build/core-data/index.js 10.6 kB 0 B
build/data-controls/index.js 1.04 kB 0 B
build/data/index.js 8.21 kB 0 B
build/date/index.js 5.37 kB 0 B
build/deprecated/index.js 772 B 0 B
build/dom-ready/index.js 568 B 0 B
build/dom/index.js 3.06 kB 0 B
build/edit-site/index.js 4.64 kB 0 B
build/edit-site/style-rtl.css 2.48 kB 0 B
build/edit-site/style.css 2.48 kB 0 B
build/edit-widgets/index.js 4.45 kB 0 B
build/edit-widgets/style-rtl.css 2.58 kB 0 B
build/edit-widgets/style.css 2.58 kB 0 B
build/editor/editor-styles-rtl.css 381 B 0 B
build/editor/editor-styles.css 382 B 0 B
build/editor/style-rtl.css 3.97 kB 0 B
build/editor/style.css 3.96 kB 0 B
build/element/index.js 4.45 kB 0 B
build/escape-html/index.js 733 B 0 B
build/format-library/index.js 7.09 kB 0 B
build/format-library/style-rtl.css 502 B 0 B
build/format-library/style.css 502 B 0 B
build/hooks/index.js 1.92 kB 0 B
build/html-entities/index.js 621 B 0 B
build/i18n/index.js 3.49 kB 0 B
build/is-shallow-equal/index.js 710 B 0 B
build/keyboard-shortcuts/index.js 2.3 kB 0 B
build/keycodes/index.js 1.68 kB 0 B
build/list-reusable-blocks/index.js 2.99 kB 0 B
build/list-reusable-blocks/style-rtl.css 226 B 0 B
build/list-reusable-blocks/style.css 226 B 0 B
build/media-utils/index.js 4.85 kB 0 B
build/notices/index.js 1.57 kB 0 B
build/nux/index.js 3.01 kB 0 B
build/nux/style-rtl.css 616 B 0 B
build/nux/style.css 613 B 0 B
build/plugins/index.js 2.54 kB 0 B
build/primitives/index.js 1.49 kB 0 B
build/priority-queue/index.js 779 B 0 B
build/redux-routine/index.js 2.84 kB 0 B
build/rich-text/index.js 14.3 kB 0 B
build/server-side-render/index.js 2.55 kB 0 B
build/shortcode/index.js 1.7 kB 0 B
build/token-list/index.js 1.27 kB 0 B
build/url/index.js 4.01 kB 0 B
build/viewport/index.js 1.61 kB 0 B
build/warning/index.js 1.14 kB 0 B
build/wordcount/index.js 1.18 kB 0 B

compressed-size-action

@github-actions
Copy link

Size Change: +13 B (0%)

Total Size: 856 kB

Filename Size Change
build/editor/index.js 43.8 kB +13 B (0%)
ℹ️ View Unchanged
Filename Size Change
build/a11y/index.js 1.01 kB 0 B
build/annotations/index.js 3.43 kB 0 B
build/api-fetch/index.js 3.39 kB 0 B
build/autop/index.js 2.58 kB 0 B
build/blob/index.js 620 B 0 B
build/block-directory/index.js 6.03 kB 0 B
build/block-directory/style-rtl.css 760 B 0 B
build/block-directory/style.css 760 B 0 B
build/block-editor/index.js 100 kB 0 B
build/block-editor/style-rtl.css 10.7 kB 0 B
build/block-editor/style.css 10.7 kB 0 B
build/block-library/editor-rtl.css 7.23 kB 0 B
build/block-library/editor.css 7.24 kB 0 B
build/block-library/index.js 111 kB 0 B
build/block-library/style-rtl.css 7.38 kB 0 B
build/block-library/style.css 7.39 kB 0 B
build/block-library/theme-rtl.css 669 B 0 B
build/block-library/theme.css 671 B 0 B
build/block-serialization-default-parser/index.js 1.65 kB 0 B
build/block-serialization-spec-parser/index.js 3.1 kB 0 B
build/blocks/index.js 57.7 kB 0 B
build/components/index.js 191 kB 0 B
build/components/style-rtl.css 15.7 kB 0 B
build/components/style.css 15.7 kB 0 B
build/compose/index.js 6.22 kB 0 B
build/core-data/index.js 10.6 kB 0 B
build/data-controls/index.js 1.04 kB 0 B
build/data/index.js 8.21 kB 0 B
build/date/index.js 5.37 kB 0 B
build/deprecated/index.js 772 B 0 B
build/dom-ready/index.js 568 B 0 B
build/dom/index.js 3.06 kB 0 B
build/edit-post/index.js 91.3 kB 0 B
build/edit-post/style-rtl.css 8.62 kB 0 B
build/edit-post/style.css 8.62 kB 0 B
build/edit-site/index.js 4.64 kB 0 B
build/edit-site/style-rtl.css 2.48 kB 0 B
build/edit-site/style.css 2.48 kB 0 B
build/edit-widgets/index.js 4.45 kB 0 B
build/edit-widgets/style-rtl.css 2.58 kB 0 B
build/edit-widgets/style.css 2.58 kB 0 B
build/editor/editor-styles-rtl.css 381 B 0 B
build/editor/editor-styles.css 382 B 0 B
build/editor/style-rtl.css 3.97 kB 0 B
build/editor/style.css 3.96 kB 0 B
build/element/index.js 4.45 kB 0 B
build/escape-html/index.js 733 B 0 B
build/format-library/index.js 7.09 kB 0 B
build/format-library/style-rtl.css 502 B 0 B
build/format-library/style.css 502 B 0 B
build/hooks/index.js 1.92 kB 0 B
build/html-entities/index.js 621 B 0 B
build/i18n/index.js 3.49 kB 0 B
build/is-shallow-equal/index.js 710 B 0 B
build/keyboard-shortcuts/index.js 2.3 kB 0 B
build/keycodes/index.js 1.68 kB 0 B
build/list-reusable-blocks/index.js 2.99 kB 0 B
build/list-reusable-blocks/style-rtl.css 226 B 0 B
build/list-reusable-blocks/style.css 226 B 0 B
build/media-utils/index.js 4.85 kB 0 B
build/notices/index.js 1.57 kB 0 B
build/nux/index.js 3.01 kB 0 B
build/nux/style-rtl.css 616 B 0 B
build/nux/style.css 613 B 0 B
build/plugins/index.js 2.54 kB 0 B
build/primitives/index.js 1.49 kB 0 B
build/priority-queue/index.js 779 B 0 B
build/redux-routine/index.js 2.84 kB 0 B
build/rich-text/index.js 14.3 kB 0 B
build/server-side-render/index.js 2.55 kB 0 B
build/shortcode/index.js 1.7 kB 0 B
build/token-list/index.js 1.27 kB 0 B
build/url/index.js 4.01 kB 0 B
build/viewport/index.js 1.61 kB 0 B
build/warning/index.js 1.14 kB 0 B
build/wordcount/index.js 1.18 kB 0 B

compressed-size-action

@github-actions
Copy link

Size Change: +115 B (0%)

Total Size: 857 kB

Filename Size Change
build/edit-site/style-rtl.css 2.53 kB +47 B (1%)
build/edit-site/style.css 2.53 kB +47 B (1%)
build/editor/index.js 43.8 kB +21 B (0%)
ℹ️ View Unchanged
Filename Size Change
build/a11y/index.js 1.01 kB 0 B
build/annotations/index.js 3.43 kB 0 B
build/api-fetch/index.js 3.39 kB 0 B
build/autop/index.js 2.58 kB 0 B
build/blob/index.js 620 B 0 B
build/block-directory/index.js 6.03 kB 0 B
build/block-directory/style-rtl.css 760 B 0 B
build/block-directory/style.css 760 B 0 B
build/block-editor/index.js 100 kB 0 B
build/block-editor/style-rtl.css 10.7 kB 0 B
build/block-editor/style.css 10.7 kB 0 B
build/block-library/editor-rtl.css 7.23 kB 0 B
build/block-library/editor.css 7.24 kB 0 B
build/block-library/index.js 111 kB 0 B
build/block-library/style-rtl.css 7.38 kB 0 B
build/block-library/style.css 7.39 kB 0 B
build/block-library/theme-rtl.css 669 B 0 B
build/block-library/theme.css 671 B 0 B
build/block-serialization-default-parser/index.js 1.65 kB 0 B
build/block-serialization-spec-parser/index.js 3.1 kB 0 B
build/blocks/index.js 57.7 kB 0 B
build/components/index.js 191 kB 0 B
build/components/style-rtl.css 15.7 kB 0 B
build/components/style.css 15.7 kB 0 B
build/compose/index.js 6.22 kB 0 B
build/core-data/index.js 10.6 kB 0 B
build/data-controls/index.js 1.04 kB 0 B
build/data/index.js 8.21 kB 0 B
build/date/index.js 5.37 kB 0 B
build/deprecated/index.js 772 B 0 B
build/dom-ready/index.js 568 B 0 B
build/dom/index.js 3.06 kB 0 B
build/edit-post/index.js 91.3 kB 0 B
build/edit-post/style-rtl.css 8.62 kB 0 B
build/edit-post/style.css 8.62 kB 0 B
build/edit-site/index.js 4.64 kB 0 B
build/edit-widgets/index.js 4.45 kB 0 B
build/edit-widgets/style-rtl.css 2.58 kB 0 B
build/edit-widgets/style.css 2.58 kB 0 B
build/editor/editor-styles-rtl.css 381 B 0 B
build/editor/editor-styles.css 382 B 0 B
build/editor/style-rtl.css 3.97 kB 0 B
build/editor/style.css 3.96 kB 0 B
build/element/index.js 4.45 kB 0 B
build/escape-html/index.js 733 B 0 B
build/format-library/index.js 7.09 kB 0 B
build/format-library/style-rtl.css 502 B 0 B
build/format-library/style.css 502 B 0 B
build/hooks/index.js 1.92 kB 0 B
build/html-entities/index.js 621 B 0 B
build/i18n/index.js 3.49 kB 0 B
build/is-shallow-equal/index.js 710 B 0 B
build/keyboard-shortcuts/index.js 2.3 kB 0 B
build/keycodes/index.js 1.68 kB 0 B
build/list-reusable-blocks/index.js 2.99 kB 0 B
build/list-reusable-blocks/style-rtl.css 226 B 0 B
build/list-reusable-blocks/style.css 226 B 0 B
build/media-utils/index.js 4.85 kB 0 B
build/notices/index.js 1.57 kB 0 B
build/nux/index.js 3.01 kB 0 B
build/nux/style-rtl.css 616 B 0 B
build/nux/style.css 613 B 0 B
build/plugins/index.js 2.54 kB 0 B
build/primitives/index.js 1.49 kB 0 B
build/priority-queue/index.js 779 B 0 B
build/redux-routine/index.js 2.84 kB 0 B
build/rich-text/index.js 14.3 kB 0 B
build/server-side-render/index.js 2.55 kB 0 B
build/shortcode/index.js 1.7 kB 0 B
build/token-list/index.js 1.27 kB 0 B
build/url/index.js 4.01 kB 0 B
build/viewport/index.js 1.61 kB 0 B
build/warning/index.js 1.14 kB 0 B
build/wordcount/index.js 1.18 kB 0 B

compressed-size-action

@earnjam
Copy link
Contributor Author

earnjam commented Mar 14, 2020

Ok, tests are passing now.

This primarily needs UX feedback, since there isn't much programmatically changed here.

@mapk
Copy link
Contributor

mapk commented Mar 18, 2020

Draft is basically the same thing as private but with the possibility of a floating date. Private must have a date set.) Is that too confusing?

Yes! 😆 This whole system of draft vs. private vs. published leaves me in confusion every time.

Should we add a snackbar notice or something similar to make that more obvious that it has occurred?

Yes again. If we're switching a setting on the post that isn't obvious to the user (ie. switching a draft post back to public) we should alert the user. That's kinda a big deal. A Snackbar notification sounds like the right way to go. Can you include that in this PR, @earnjam?

@mapk mapk removed the Needs Design Feedback Needs general design feedback. label Mar 18, 2020
@earnjam
Copy link
Contributor Author

earnjam commented Mar 18, 2020

@mapk We already show a snackbar notice when reverting to a draft. What do we think about modifying the message in the notice to something like this? I worry it isn't visible enough.

Current notice:
Screen Shot 2020-03-18 at 7 41 03 PM

Modified message:
Screen Shot 2020-03-18 at 7 45 00 PM

@earnjam
Copy link
Contributor Author

earnjam commented Mar 19, 2020

I should also clarify that this wouldn't be something new to this PR. Currently if you revert a private post to draft, then it switches the visibility to public and does not tell you. This PR does not change that.

@mapk
Copy link
Contributor

mapk commented Apr 14, 2020

Love it. Let's add that additional text to the snackbar notice! Thanks, @earnjam.

@mapk
Copy link
Contributor

mapk commented Apr 14, 2020

I just tried testing the PR and got this:

Screen Shot 2020-04-13 at 8 04 14 PM

No msg about the visibility. Is that included here?

@earnjam
Copy link
Contributor Author

earnjam commented Apr 15, 2020

@mapk Right, that's the current version that we already have. I haven't updated it on this branch yet! 🙂

@mtias
Copy link
Member

mtias commented Apr 15, 2020

Missed the prior conversation here. The relationships between statuses is very convoluted and leads to an awkward experience. I agree with the comments about trying to improve it and work around the data and status design. That's the point of the "switch to draft" action as well, as it encapsulates something that makes sense for the user.

That said, I do worry a bit about the implications for a user switching the status and then doing a lot of changes. In my testing, after saving a draft, switching it to "private", making some updates, letting the browser sit for a bit, and then reloading the page actually ended up publishing the post as private. I don't think this experience would be super great even if we address the auto-save issue that seems to be happening. Would a user have clarity on whether things are saved or published?

Regarding the snack-bar notice, I'd suggest tweaking the wording to be something like "Post reverted to draft and reseted its visibility". Otherwise it could be misleading as a sentence — I reverted to draft to make it private why would you say it's set to public again?! "Public draft" reads a bit as an oxymoron.

@mapk
Copy link
Contributor

mapk commented Apr 30, 2020

Good point @mtias. How about...

"Post reverted to draft and caused the visibility to be reset."

@earnjam
Copy link
Contributor Author

earnjam commented May 1, 2020

Digging into the autosave issue mentioned by @mtias, I realized it is in fact autosaving the status change. This occurs for any status that isn't already private.

I tested putting in some logic to prevent autosaves, and that worked ok because the post is considered dirty when the status is changed. So the user can't navigate away without knowing they are going to lose something.

The keyboard saves are a harder problem to solve. We currently block them at the UI level to prevent posts from being saved if they aren't considered dirty. We could add on to that, even though it really should be handled at a lower level. Regardless of where it's done though, I don't think that randomly disabling keyboard saves is optimal when the post is otherwise considered dirty, even if we were to show a notice saying it didn't save and why it didn't save.

Not passing the status in the autosave would allow content work to be saved, but then it doesn't know about the visibility change if you were to restore it.

I'm running out of ideas for how to handle it. Short of data storage changes, which are frankly not likely to ever occur, I'm not sure how to tackle this in a graceful way. We'd be trading one inconsistency (a sidebar control publishing the post immediately) for a new one (blocking saves under certain conditions that wouldn't make sense to users).

If anyone has any other ideas I'm happy to run with them, but otherwise I think I'll bow out of this one and focus on something else.

The snackbar notice verbiage change is an independent issue from this PR. That is something that occurs right now and could be solved separately. So someone can open a PR just for that change if they want. It would require a new label added to the list of post type labels, so it would need a trac ticket and patch as well.

@earnjam earnjam closed this May 1, 2020
@earnjam earnjam deleted the try/delay-private-publish branch May 1, 2020 11:40
@mtias
Copy link
Member

mtias commented May 1, 2020

Thanks for attempting this and recapping @earnjam. That's my takeaway as well. There is a fundamental problem in the way the data is modelled and the UI will have to be trading faithfulness to the true state (clarity) with an inconvenient experience. In that sense, being upfront about what would happen (forcing to publish privately) is likely a better tradeoff since it reduces the potential for the user making a mistake.

I guess we could look into storing a "fake-status" of pending-private that only stores the intention of switching the status to "private" when the user goes through the publish button flow. That would allow us to present the UI as if the status was both unpublished and private (the real status would be just "draft" and wouldn't conflict with auto-saves).

This has its fair share of problems, though, since it's an ad hoc status that only the editor (so far) would understand and not the wider ecosystem — for any other external editor, app, plugin, etc, the post would be just set to "draft", which means if you publish through any mechanism that is not the editor WordPress won't necessarily know to set it as "private" at the right time, which could lead to disclosing information and a much bigger problem than the UI inconvenience we were trying to address.

We could move a layer deeper and try to have this "fake status" at a lower level, and ensure all publish actions and hooks are able to account for it if it's set, but I'd imagine it will still possibly lead to issues if a client or flow somehow unawarely forces the "publish" status in a way that WP cannot intercept. If we were to explore anything like it, it'd probably have to be thoroughly thought out and presented more widely as a proposal since the current state has been the status quo for so long.

@earnjam
Copy link
Contributor Author

earnjam commented May 1, 2020

I thought about possible ways to save it externally to status temporarily, but nothing seemed quite right and had the shortcomings you mentioned about other editors or external code not being aware of it.

The cleanest method is just a break of backwards compatibility on private as a post status. But that is such a massive breaking change that I don't see that realistically happening unless it's part of a major undertaking to shift the way we handle content restrictions as a whole. That's something core has never done well and the legacy design makes it near impossible to change without breaking a lot of stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backwards Compatibility Issues or PRs that impact backwards compatability [Feature] Saving Related to saving functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting post visibility to "private" forces immediate publishing of post
10 participants