[wp-trac] [WordPress Trac] #43316: REST API: Support autosaves

WordPress Trac noreply at wordpress.org
Sun Mar 11 17:58:38 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:33 adamsilverstein]:
 > to use get_item, you need to know the item id.

 Hm, this is pretty useless for autosaves (that can be deleted on the next
 request). When would a client know the autosave ID for a post? Would it
 need to do another request to get it first? Then, why two requests? :)

 Generally the client doesn't care about autosaves except when loading a
 post for editing. Then it should "know" if there is an autosave that is
 newer than the post.

 If `get_item()` for autosaves has to be done only by autosave ID, there is
 no point of it. An autosave can already be requested by ID through the
 revisions controller.

 > One other issue with returning all autosaves: you only have permission
 to read the autosave belonging to your user. I think the

 No. Autosaves are revisions and `inherit` the permissions of the parent
 post. Anybody that can edit the post can view the autosaves (just like the
 rest of the revisions).

 > Ah, I see what you are saying - the client wants to update the draft
 without creating another revision. Perhaps this logic should be in the
 posts controller?

 Yeah, that was the gist of the discussion in Slack as far as I understood.
 We shouldn't use the posts controller (with flags) for autosaving. That's
 why we went with a separate controller.

 > performance of the check of how much has changed is important so we
 should probably keep it simple, as the text grows large and this will fire
 on every autosave. `str_len` may be all we need?

 Yeah, perhaps can start with that. lets say 20% difference in size would
 trigger a "full save" on autosave requests.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/43316#comment:35>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list