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

WordPress Trac noreply at wordpress.org
Fri Mar 23 21:42:35 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):

 In 43316.9.diff:
 - Fixed/tweaked logic in `create_item()`.
 - Added check if `DOING_AUTOSAVE` is defined.
 - Added check if the post_author is the current user when updating a
 draft.
 - Added slashes when calling `wp_update_post()`.
 - Removed `update_item()`. The "business logic" of autosaves is either to
 create, delete or update the autosave revision. Don't think we need a
 separate `update_item()` which may actually need to delete the item :)
 - Fixed the logic a bit and added slashing to `create_post_autosave()`.
 - Changed the detection of "significantly different" content. Now uses
 combination of percentage for shorter content and fixed size for longer
 content. It's still not ideal, but seems sufficient and very fast.

 Still TODO: thinking we need few more tests especially testing content
 with slashes. That would be good for the posts controller too :)

 @adamsilverstein could you have a look if all is good? :)

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


More information about the wp-trac mailing list