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

WordPress Trac noreply at wordpress.org
Mon Apr 23 16:18:21 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:80 danielbachhuber]:
 > * Re: `create_item_permissions_check()`, I'd be concerned about a point
 in the future where
 `$this->parent_controller->update_item_permissions_check()` changed and
 caused an unexpected change in behavior in this controller. If we want to
 create an explicit internal API for this, we should do so; otherwise, we
 should copy the contents into this method.

 Hmm, possibly but the opposite is also true. An autosave revision is
 always in a "post update" context and needs the same permissions. If we
 are to copy/duplicate the functions we most likely will end up having to
 update them in tandem with the same functions in the posts controller.

 Thinking that we can keep using the posts cap check for now. If it needs
 changes and these changes are not needed for the autosaves, can copy the
 functions then.

 > * Re: `create_item()`, we should change the `id` argument into `post` or
 something else. `id` is always a read-only value generated by the database
 elsewhere in the REST API.

 Which `id` argument do you have in mind? The parent post ID in
 `/wp/v2/posts/{id}/autosaves`? This seems to be the standard way of
 creating a sub-item in REST. The same ID has to be set in the $request
 (same as when updating a post). IMHO that makes sense when dealing with a
 sub-item.

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


More information about the wp-trac mailing list