Skip to content
This repository has been archived by the owner on Sep 24, 2018. It is now read-only.

Abstract revisions to dedicated controller; only include revisioned fields #1110

Merged
merged 3 commits into from Apr 17, 2015

Conversation

danielbachhuber
Copy link
Member

Fixes #869, #855
See #894, #314

@danielbachhuber
Copy link
Member Author

@WP-API/amigos #reviewmerge


$post = get_post( $request['id'] );
if ( ! $post || 'revision' !== $post->post_type ) {
return new WP_Error( 'json_post_invalid_id', __( 'Invalid revision ID.' ), array( 'status' => 404 ) );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Elsewhere we have not thrown invalid errors in the permissions checks. We'd typically not return any error in the case of the post not existing, or being the wrong post type - and handle that check in the get_item callback it's self.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joehoyle
Copy link
Member

Just a concern around the error checking done in the permissions callbacks, as I'm not sure if that is the best place for those checks. Apart from that - I'm happy.

joehoyle added a commit that referenced this pull request Apr 17, 2015
Abstract revisions to dedicated controller; only include revisioned fields
@joehoyle joehoyle merged commit 327ab87 into develop Apr 17, 2015
@joehoyle joehoyle deleted the 869-revisions branch April 17, 2015 20:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create WP_JSON_Revisions_Controller
2 participants