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

Fix/post scheduling hotfix #13726

Merged
merged 6 commits into from
Mar 27, 2020
Merged

Fix/post scheduling hotfix #13726

merged 6 commits into from
Mar 27, 2020

Conversation

bjtitus
Copy link
Contributor

@bjtitus bjtitus commented Mar 25, 2020

Fixes #13655
Fixes #13654
Fixes #13710

Fixes the following issues:

  • "Publish Immediately" logic being shown when Draft was back scheduled. (seems to be the same issue seen in Cannot back date a draft #13710)
  • Post button (in the upper right of the editor) displaying the wrong action after changing the publish date.
  • Adds a simple confirmation dialog so it is extra clear when a Post moves from a non-published status to Published.

To Test

Back Scheduled Draft

A draft should be able to be scheduled in the past. Previously, "Immediately" was shown as the selected Date/Time. See #13710 for more details.

Before After

Confirmation Dialog

A confirmation dialog should show any time the post is Published from a non-published status. This is a temporary solution for #13654 to make it more obvious to users when a post will move to "Published". Note that this happens any time a post moves to Published from another status, not just when backdating a post.

Move to Draft

Move an existing Published post to Draft. The Published date in Post Settings should be retained. See #13655 for more details.

Known Issues

  • "Publish Immediately" on an already published post changes the published date to the current date and time but does not show "Immediately".
  • Scheduling a Post and then Publishing it seems to show the wrong "Action" button. Shouldn't the button say "Publish" since the status is changing from "Scheduled" to "Published"? The Publish confirmation is also not shown in this case.

PR submission checklist:

  • I have considered adding unit tests where possible.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@bjtitus bjtitus added this to the 14.5 ❄️ milestone Mar 25, 2020
@bjtitus bjtitus self-assigned this Mar 25, 2020
@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Mar 25, 2020

You can test the changes on this Pull Request by downloading it from AppCenter here with build number: 25661. IPA is available here. If you need access to this, you can ask a maintainer to add you.

@bjtitus bjtitus marked this pull request as ready for review March 25, 2020 18:03
@ScoutHarris
Copy link
Contributor

Hey @bjtitus . There's some possible oddities with 'Back Scheduled Draft'.


  • Start a new post.
  • Go to publish date/time.
  • Select the past.
  • The Status says Published.

  • Save a post as draft with past date.
  • Go to Blog Posts > Drafts.
  • On the draft, select Publish Now.
  • On the post, go to Published and note the published date is the current date/time.

  • Save a post as draft with past date.
  • Go to Blog Posts > Drafts.
  • Note the date displayed is the one selected in the past.
  • Edit the draft, and go to Post Settings.
  • Notice the date now says Immediately.

@bjtitus
Copy link
Contributor Author

bjtitus commented Mar 26, 2020

I believe the first two are mainly choices with the current flow. I think there are a bunch of questions about what we should do in these cases now that we're taking a closer look.

I think 3 is a bug but appears to be a long standing one. I think it should be fixed properly in 14.6 or later.

1. Past date changes status to Published

Any selection from the Schedule calendar control sets the status to Published or Scheduled. Keeping the status as "Draft" would require you to manually select "Published" or "Scheduled" from the Post Settings screen. This was a conscious choice that seemed to mirror the previous functionality but could be changed to keep the Post status as whatever it was to begin with.

2. Publish Now

As far as I can tell, this is consistent with the previous logic (nothing has changed with that button's actions AFAIK). I interpret "Publish Now" to mean: change the date to "Now" and Publish.

3. "Publish Immediately" on a brand new + backdated post

Interestingly, this doesn't happen after the post has been saved once and then the date is changed. This appears to be a bug and requires some explanation about how "Immediately" actually works:

  • Change publish date of the post = dateCreated property is set on AbstractPost
  • AbstractPost's dateCreated property is sent as date property to API (see https://developer.wordpress.org/rest-api/reference/posts/ for API reference)
  • date property appears to be used to fill in the modified property on a brand new post
  • "Publish Immediately" is shown whenever the dateCreated and dateModified properties are equal or dateCreated is nil.
  • The app shows "Publish Immediately" because dateModified has been set to dateCreated by the server since there is only the one date property.

There's no way to set a separate modified date, as it is read-only in the API. The only way I've figure out to handle this is to first upload the draft using the dateModified date (current date) and then update that same post with the proper dateCreated date for publishing.

I tested 3 on Build 14.1 (21544) with the Scheduled Feature Flag disabled and noticed the same exact behavior. Not sure if this was introduced when offline posting was added, or if it has always been like this.

Here's a recording of the third issue on Build 14.1 (21544) with the Scheduled Feature Flag turned off. Notice that it has saved the date but shows "Immediately" because dateCreated and dateModified are equal.

@ScoutHarris
Copy link
Contributor

Hey @bjtitus . Thanks for the thorough explanations! Given that, I think this fulfills it's intent.

@bjtitus bjtitus merged commit 221ca7f into release/14.5 Mar 27, 2020
@bjtitus bjtitus deleted the fix/post-scheduling-hotfix branch March 27, 2020 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants