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

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

Merged
merged 1 commit into from
Feb 16, 2018

Conversation

aduth
Copy link
Member

@aduth aduth commented Feb 15, 2018

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
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.

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