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

WordPress Trac noreply at wordpress.org
Sun Mar 11 16:50:04 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 adamsilverstein):

 > what is the difference between get_item() and get_items()?

 get_items only requires that you know the parent post id. to use get_item,
 you need to know the item id. One other issue with returning all
 autosaves: you only have permission to read the autosave belonging to your
 user. I think the

 > If we don't update drafts when the client does autosave, how is that
 going to work?

 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?  - that is, if you update a  post and its in a draft
 state, set a flag that prevents a revision from being created. so then for
 autosaves, the client would need to send post updates if the post is draft
 or autosaves otherwise.

 > This is still going to be an "automatic" decision. We will need a good
 method of determining when the post data is sufficiently different,
 strlen() may work but some basic diff that counts the changes would be
 better.

 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?

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


More information about the wp-trac mailing list