[wp-trac] [WordPress Trac] #43316: REST API: Support autosaves
WordPress Trac
noreply at wordpress.org
Sun Mar 11 16:10:33 UTC 2018
#43316: REST API: Support autosaves
-------------------------------------------------+-------------------------
Reporter: kraftbj | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 5.0
Component: REST API | Version:
Severity: normal | Resolution:
Keywords: has-patch needs-testing needs-unit- | Focuses: rest-api
tests |
-------------------------------------------------+-------------------------
Comment (by azaozz):
Replying to [comment:30 adamsilverstein]:
> For #4 currently i return the current users 'autosaves' (there is only
ever one). I can see the use case for wanting all autosaves, then you pass
author_id to find your own autosave, right?
Yeah, I'm not so sure about that either. But then what is the difference
between `get_item()` and `get_items()`? There are cases with more than one
autosave pet post (created for different users). This is currently exposed
on the Post Revisions screen, together with the rest of the revisions.
Should we return all of them or should we just remove `get_items()`?
There is a need to expose `wp_get_post_autosave()` through the API. Need
to get an autosave without knowing the autosave_id, just by the post_id.
How are we doing that?
> For #5 it should return the autosave or an error.
Ok, then we need to remove the `0`.
> Thinking about this more, I don't think the autosave controller should
update the post, even for drafts. the client can decide whether to issue a
post update or create an autosave based on the post status - this seems
like a client responsibility.
This was one of the main "problems" discussed in Slack. Think we settled
on "The cliend should care about the user UI and how to display the data,
the server should care about the business (of saving)".
If we don't update drafts when the client does autosave, how is that going
to work? It is not possible to do through the posts controller. Or we have
to add a hack (a.k.a a flag) to disable automatic revisions on save.
Thinking we should go with the consensus from the chat in Slack and let
the autosaves controller take care of the "business" of saving where
appropriate. If the client wants to save a post instead of autosaving it,
it can at any time :)
> I started working on enabling EDITABLE support (so you could 'update' an
autosave), realizing now we don't have that for revisions so going to
remove.
Right. Revisions should never be updated. Think of them like user created
"backups" for the post. Autosaves should be updated, they are "special"
revisions where the special part is being updated or deleted
automatically, that's the "auto" part in the name :)
> In [attachment:43316.5.diff] I added a suite of unit tests matching what
we have for revisions.
In 43316.1.patch I added few autosave tests but for the patched posts
controller. Need to fix them to run for the autosaves controller.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43316#comment:31>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list