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

WordPress Trac noreply at wordpress.org
Thu Jun 21 13:40:37 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):

 Replying to [comment:90 aduth]:
 > ...I'm confused by the proposed flow where an error is returned from the
 endpoint (when deleting identical autosaves).
 >
 > 1. Do we really need to return an error? Can't we just treat it as
 though it were successful even if in-fact the server is ensuring there are
 no redundant revisions?

 Yeah, generally the autosave logic is pretty complex. I'd be happy if we
 can streamline it a bit (for the API), if possible.

 Deleting an autosave revision when the content is identical to the
 post_content is done for two reasons:
 - It ensures there aren't any revisions with no diff/without any changes.
 - It reduces the number of revisions.

 Don't think the second reason matters much, but the first is confusing
 when viewing revisions, so this behaviour makes sense.

 > 2. Because we delete the revision and then return immediately with an
 error, isn't it true that we're not simply not storing redundant revision,
 we're in fact destroying a revision without having anything new to serve
 in its place?

 Yes, that's true. Technically there is no reason to delete the old
 autosave revision. Even then, what should be returned for such requests?
 Seems we have to return the "old" autosave ID? Then the autosave revision
 content will be different from the submitted content.

 Another option is to standardize on always returning the post_ID of the
 actual post being edited. Currently this is the case for drafts (same
 user) when the post is updated, but the returned ID is the autosave
 revision ID when draft for different user or published post. Thinking it
 will probably be best to always return the "real" post_ID for all autosave
 requests.

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


More information about the wp-trac mailing list