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

WordPress Trac noreply at wordpress.org
Thu Oct 18 13:40:32 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 has-unit-tests commit  |     Focuses:  rest-api

Comment (by adamsilverstein):

 @azaozz  - Thanks for reviewing, I had a feeling we needed to leave that.
 I was surprised tests all passed - seems like we should test for the
 condition that not having that set breaks.

 One other idea was to unset the constant at the end of the `create_item`
 method, however we would need to be sure `runkit_constant_remove` was

 > Then there's the DOING_AUTOSAVE filter approach.

 This would be ideal because it seems wrong that calling `create_item` sets
 a constant and leaves it that way - this assumes it is running in
 isolation when in fact that may not be the case.

 > We do. Or we are back at the beginning with revisions created for each
 draft save.

 As far as I can tell that is because of this check:
 includes/revision.php#L111-L114. Wrapping that in a filter would we could
 add and remove in this callback would be ideal, thoughts?

 > Another is to just do define( 'DOING_AUTOSAVE', false )

 maybe for now we can set it this way for tests, and use
 `runkit_constant_redefine` to set it to true for the autosave tests

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

More information about the wp-trac mailing list