Make WordPress Core


Ignore:
Timestamp:
11/15/2018 12:56:54 PM (6 years ago)
Author:
danielbachhuber
Message:

REST API: Avoid using 'parent' as path argument name for autosaves.

When 'parent' is set as the path argument name, it gets passed down through to the create_item() method and can erroneously reset the 'parent' value on the post itself. Instead, we rename the argument to 'id' and replicate the revision controller's get_items_permissions_check() to instead reference 'id'.

Also ensures revision query params (of which there are many) aren't exposed as the query params for autosaves (of which there are two).

Props TimothyBlynJacobs.
See #43316.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/5.0/tests/phpunit/tests/rest-api/rest-schema-setup.php

    r43852 r43897  
    9090            '/wp/v2/posts/(?P<parent>[\\d]+)/revisions',
    9191            '/wp/v2/posts/(?P<parent>[\\d]+)/revisions/(?P<id>[\\d]+)',
    92             '/wp/v2/posts/(?P<parent>[\\d]+)/autosaves',
     92            '/wp/v2/posts/(?P<id>[\\d]+)/autosaves',
    9393            '/wp/v2/posts/(?P<parent>[\\d]+)/autosaves/(?P<id>[\\d]+)',
    9494            '/wp/v2/pages',
     
    9696            '/wp/v2/pages/(?P<parent>[\\d]+)/revisions',
    9797            '/wp/v2/pages/(?P<parent>[\\d]+)/revisions/(?P<id>[\\d]+)',
    98             '/wp/v2/pages/(?P<parent>[\\d]+)/autosaves',
     98            '/wp/v2/pages/(?P<id>[\\d]+)/autosaves',
    9999            '/wp/v2/pages/(?P<parent>[\\d]+)/autosaves/(?P<id>[\\d]+)',
    100100            '/wp/v2/media',
     
    102102            '/wp/v2/blocks',
    103103            '/wp/v2/blocks/(?P<id>[\d]+)',
    104             '/wp/v2/blocks/(?P<parent>[\d]+)/autosaves',
     104            '/wp/v2/blocks/(?P<id>[\d]+)/autosaves',
    105105            '/wp/v2/blocks/(?P<parent>[\d]+)/autosaves/(?P<id>[\d]+)',
    106106            '/wp/v2/types',
Note: See TracChangeset for help on using the changeset viewer.