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

WordPress Trac noreply at wordpress.org
Fri Apr 6 15:52:33 UTC 2018


#43316: REST API: Support autosaves
-------------------------------------------------+-------------------------
 Reporter:  kraftbj                              |       Owner:  rmccue
     Type:  enhancement                          |      Status:  assigned
 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):

 Looking at 43316.13.diff, it introduces quite a few inconsistencies. It
 kind of treats autosaves as different post_type, but still keeps them as
 revisions. It also moves all auto-saving logic to the client and requires
 the client to manipulate the data to be able to save. There are also few
 regressions compared with the current logic.

 1. The client cannot do `autoSavePost( postContent )` the same way it does
 `savePost( postContent )`. There are quite a few differences in the data.
 This is a departure from the post saving logic that may be seen as a
 regression.
  - It has to set `parent` to be the same as post_ID. That's somewhat weird
 as an item cannot be a parent of itself :) That's even worse for pages
 where there may be an actual `post_parent` which will have to be
 overwritten with the post_ID...
  - Actually a client cannot do `autoSavePost( postContent )`. It will have
 to check whether an autosave exists (an extra trip to the server), then
 manipulate the post data to match the endpoint requirements. It seems the
 client will have to always do two requests to be able to auto-save.
 2. Autosaves on draft posts are explicitly forbidden. This is a
 regression. It means that:
  - We will not be able to ever do server-side post locking, as we will
 loose any data a second client tries to autosave.
  - When two clients try to edit the same draft, they will automatically
 stomp on each other's changes (without knowing) and there will be no
 server backup. That's not acceptable imho.

 There also seem to be few bugs (and typos) in update_item() and
 update_item_permissions_check() but before looking at them I'd like to
 look at the proposed functionality from a clien't point of view.
 - The difference between saving and auto-saving is quite large.
 - Auto-saving seems needlessly complex and that's not warranted.
 - The server logic is completely overridden/ignored and the (untrusted)
 client has access to making some low-level decision which seems to be a
 regression.

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


More information about the wp-trac mailing list