Skip to content

State: Set new post status to draft in initialization - #5089

Merged
aduth merged 1 commit into
masterfrom
fix/initialize-new-draft
Feb 16, 2018
Merged

aduth merged 1 commit into
masterfrom
fix/initialize-new-draft

Conversation

@aduth

@aduth aduth commented Feb 15, 2018

Copy link
Copy Markdown
Member

Related: #4956 (review)

This pull request seeks to simplify the behavior for setting a new post's status to draft, taking advantage of existing mechanisms put in place for setting the "Auto Draft" title to an empty string. This has the advantage of removing several ad-hoc checks, and avoids both the dispatch itself, but more importantly the creation of an undo level during the first save (since the EDIT_POST action is considered a change to undo).

We can still rely on the behavior of isEditedPostNew to check the currentPost.status, which will reflect the saved value prior to the initialization action setting edits values. This has been reflected in updated unit tests simulating a real-world scenario.

Testing instructions:

Verify that there are no regressions in the behavior of saving a new post. Notably:

  • Saving a new post should save it as draft status (can verify in the posts list or in the network response)
  • Elements not shown for new posts are still not shown (e.g. permalink)

@aduth aduth added the Framework Issues related to broader framework topics, especially as it relates to javascript label Feb 15, 2018

@youknowriad youknowriad left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This makes a lot of sense. Thanks 👍

@aduth
aduth merged commit 1076953 into master Feb 16, 2018
@aduth
aduth deleted the fix/initialize-new-draft branch February 16, 2018 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Framework Issues related to broader framework topics, especially as it relates to javascript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants