I expect that when I schedule a post, my selected publish date will be respected.
Private posts can't be scheduled, but I'm able to set a future date and set a post to private in the pre-publishing nudge. When I select "Schedule Now," the post is immediately published but has a future publish date (verified by viewing the published post on the blog).
Pre-publish nudge settings|Published with future date
-|-
|
Adding a little more context here: post.status can have either scheduled or publishPrivate. But not both.
This is a problem because right now it's impossible to schedule a private post. We have two apparently similar functions that behave differently:
[hasFuturePublishDate](https://github.com/wordpress-mobile/WordPress-iOS/blob/develop/WordPress/Classes/Models/AbstractPost.m#L386)[isScheduled()](https://github.com/wordpress-mobile/WordPress-iOS/blob/develop/WordPress/Classes/Models/AbstractPost.m#L395)The comment states that hasFuturePublishDate is different from isScheduled — the why is not very clear to me.
Anyway, even if a post has a future publish date if the status is .privatePublish it will be published right away.
I checked this with @jd-alexander and Android has the same behavior — which makes me think that this is an API issue.
I noticed something similar during 14.4 beta testing where trying to backdate and save a draft resulted in the post status changing from Draft to Published automatically, and I think this is what sends you into the loop Rachel mentioned in https://github.com/wordpress-mobile/WordPress-iOS/issues/13985 too. I re-tested with 14.7.0.2 and wanted to make a note of it. (2m14s)
The comment states that hasFuturePublishDate is different from isScheduled — the why is not very clear to me.
A post status can be future (meaning the status is future and the date_created_gmt is in the future, so isScheduled is true) but a post can also have a draft, pending, or trash status while still having a publish date set to the future (date_created_gmt is in the future but the status isn't future, so it isn't yet scheduled).
@elibud If this is an API issue, what are the best next steps to get it resolved?
@rachelmcr can you check if it works correctly in Calypso?
Calypso/Gutenberg handles the private status correctly, in that the UI doesn't make you think you're scheduling the post. As soon as you select the "Private" status, it shows a pop-up and immediately publishes the post if you accept:
If I cancel there, the status isn't changed to "Private." If I accept, the post is published.
In both cases (Calypso/Gutenberg and app) the published post retains the future date, which is a little odd but a quick look at old Core Trac tickets suggests that has always been the case (see 18264-core and 5608-core). So I guess that part of my report is expected (albeit controversial) behavior.
The main problem in the apps is that the UI suggests that the post will be scheduled (the bottom sheet shows a "Schedule Now" button), when in fact the post will be published. It may also be worth noting that the web behavior has been discussed for Gutenberg in https://github.com/WordPress/gutenberg/issues/9396 and there are some relevant comments there about what should be handled in the API vs. the UI. Given the existing discussion around the behavior, it seems like for now we should find a fix in the apps (e.g. only show a "publish" button when the status is set to "private") even if we work toward some other API change.
Got it, thanks a lot for the thorough investigation. @yaelirub can your team handle this one?