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

Posts: Scheduled posts don't move from Draft to Scheduled after being moved back to Draft and then edited. #18517

Closed
lmischner opened this issue May 5, 2022 · 4 comments
Assignees
Milestone

Comments

@lmischner
Copy link

lmischner commented May 5, 2022

Expected behavior

On saving a draft of a post that has a scheduled publish date, I see a notification with a link/prompt to publish the post. If I tap that option, it appears to confirm that the post has been scheduled.

Actual behavior

If you check the post status or other locations, the post remains in draft.

Steps to reproduce the behavior

  1. Create a draft post
  2. Tap Publish
  3. Publish for a later date
  4. Go to the Post screen > Scheduled
  5. From the 3 dot menu, move the post to the trash
  6. Go to the Post screen > Trashed
  7. From the 3 dot menu, move the post to draft
  8. Edit the post
  9. Tap "Update"
  10. When notification appears at the bottom of the screen, tap "Publish"
  11. See notification post has been scheduled
  12. Tap "View"
  13. Note further confirmation that post has been scheduled
  14. Double check in Post Settings or Drafts/Scheduled folders on Posts screen
  15. Note post is still a draft
scheduledpost.mov
Tested on iPhone XS, iOS 15.4.1, WPiOS 19.7
@tiagomar
Copy link
Contributor

tiagomar commented May 6, 2022

The scheduled post seem to get into an inconsistent state if it's edited after being moved back to Draft.

Scenario 1

  1. Create a scheduled post
  2. Go to Posts > Scheduled
  3. Tap More
  4. Tap Move to Draft
  5. Tap Publish in the notification
    ✅ The post is back to Scheduled

Scenario 2

  1. Create a scheduled post
  2. Go to Posts > Scheduled
  3. Tap More
  4. Tap Move to Draft
  5. Edit the post
  6. Tap Update
  7. Tap Publish in the notification
    ❌ The post stays in Drafts displaying the Local changes message.

Scenario 3

  1. Create a scheduled post
  2. Go to Posts > Scheduled
  3. Tap More
  4. Tap Move to Trash
  5. Go to Posts > Trashed
  6. Tap More
  7. Tap Move to Draft
  8. Tap Publish in the notification
    ✅ The post is back to Scheduled

Scenario 4

  1. Create a scheduled post
  2. Go to Posts > Scheduled
  3. Tap More
  4. Tap Move to Trash
  5. Go to Posts > Trashed
  6. Tap More
  7. Tap Move to Draft
  8. Edit the post
  9. Tap Update
  10. Tap Publish in the notification
    ❌ The post stays in Drafts displaying the Local changes message.

@tiagomar tiagomar changed the title Posts: If published via notification, post can appear to be scheduled but is still a draft Posts: Scheduled posts don't move from Draft to Scheduled after being moved back to Draft and then edited. May 6, 2022
@alpavanoglu alpavanoglu self-assigned this May 26, 2022
@alpavanoglu
Copy link
Contributor

I have investigated this issue quite a bit. Unfortunately I wasn't able to find a proper solution.
Here are my findings:

  • The issue is local. Service call is made correctly and when I checked the state from web, everything looked normal.
  • Problem only happens when the Publish notification is tapped while we're on the editor. If we first dismiss that and interact with the NoticeView on the Posts screen, there is no issue.
  • The inconsistent state is caused due to a mismatch between self.state & self.original.state in AbstractPost.m.
  • I have suspected PostNoticeViewModel ln.226 post.status = .publish as it statically assigns publish and not scheduled. Changing that didn't solve the problem.
  • Another possibility is that in AbstractPost function hasLocalChanges, there is a check isRevision() which returns false if original is nil. I suspect it must be nil but in the bug case it is not so the mismatch results in function returning true/YES.

@alpavanoglu alpavanoglu removed their assignment May 27, 2022
@hassaanelgarem hassaanelgarem self-assigned this Aug 18, 2022
@hassaanelgarem
Copy link
Contributor

I worked on this during my rotation but couldn't reach a proper solution. I was close though.
My findings:

  • The issue happens with normal drafts as well, not only scheduled posts.
  • Removing line 491 in PostEditor+Publish.swift FIXES the issue.
    • During my rotation I couldn't investigate thoroughly why this fixes it, but I believe the problem lies in having two managed objects for the same post.
    • I couldn't fully investigate what regressions (if any) this causes.

@hassaanelgarem hassaanelgarem removed their assignment Aug 19, 2022
@hassaanelgarem hassaanelgarem self-assigned this Sep 11, 2022
@kean
Copy link
Contributor

kean commented May 1, 2024

The "Publish Date" field was removed from Post Settings and the "Draft uploaded" snackbars were removed in 24.9, so it no longer applies; closing.

@kean kean closed this as completed May 1, 2024
@kean kean added this to the 24.9 milestone May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants