[wp-trac] [WordPress Trac] #39953: REST API: Add `date_floating` flag for posts
WordPress Trac
noreply at wordpress.org
Fri Aug 24 02:36:00 UTC 2018
#39953: REST API: Add `date_floating` flag for posts
------------------------------------------+-----------------------
Reporter: jnylen0 | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: 5.0
Component: REST API | Version: 4.7
Severity: normal | Resolution:
Keywords: needs-patch needs-unit-tests | Focuses: rest-api
------------------------------------------+-----------------------
Comment (by TimothyBlynJacobs):
We discussed this in the rest-api chat earlier today.
One of the options mentioned earlier in the ticket by @earnjam looks like
it should work.
> I suppose we could make a pretty good guess that it's supposed to be a
floating date when looking at the API response right now if the post
status is draft or auto-draft and date is identical to modified. The only
way I think that scenario would not be true is if you manually set the
date to the exact second you saved the draft. Highly unlikely, but it
still feels potentially unreliable.
While that solution might seem slightly weird at first glance, I think it
makes sense conceptually. If the date and the modified date are the same,
then we're still working on the post because those are both updated at
every write. As mentioned we don't have an actual `created_at` date. This
would save us having to add the new field.
We couldn't figure out a time when those two dates wouldn't match and in
testing it looked like it would work to fulfill Gutenberg's needs. We
should probably make some adjustments to the `prepare_item_for_database()`
method to not set the `edit_date` property if the two dates are the same.
Otherwise, just PUTing back the received response will cause the internal
`post_date_gmt` field to be updated and not remain as `0000....`.
In the current UI it does not appear to be possible to go back to a "date
floating" state. However, @mnelson4 brought up that it appears that you
can reset back to that state in the [Calypso
UI](https://drive.google.com/file/d/1tDB68iNGFZUfJ0cWmklKTJqpCSg3w1uE/view?usp=sharing).
Do we want to support this? @danielbachhuber mentioned that this field
would be `readonly` which to me indicates we shouldn't. If we wanted to,
though, we could support setting the `date` to `null`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39953#comment:25>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list