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

Conversation

@rmccue
Copy link
Member

@rmccue rmccue commented Mar 1, 2015

Fixes #928.

@rmccue rmccue added this to the 2.0 milestone Mar 6, 2015
@rmccue
Copy link
Member Author

rmccue commented Mar 6, 2015

Alright, the controllers are migrated, but still needs unit tests converted across. (I suspect I'll find further bugs as those are migrated.)

plugin.php Outdated
Copy link
Member Author

Choose a reason for hiding this comment

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

There should probably be a way to override this; I'm thinking $post_type->json_meta_controller_class, which defaults to the above?

Copy link
Member

Choose a reason for hiding this comment

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

I think we can just register by default for posts, users and comments, and figure out the abstraction in a later beta.

@rachelbaker
Copy link
Member

I was hoping to include a _link in the Posts response to the meta endpoint, but cannot seem to find the appropriate relationship: http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1

@rachelbaker
Copy link
Member

I am going to be out for the next 2-3 days, and haven't found a great approach for the remaining open items here. @rmccue or @joehoyle welcome to pick this up, if you can

@rmccue rmccue assigned rmccue and unassigned rachelbaker Apr 27, 2015
@rmccue
Copy link
Member Author

rmccue commented Apr 27, 2015

Meta schema & schema route

Done.

Meta links in endpoint responses
Links to the meta routes in Posts responses

Not sure what the difference between these is? I've added the link from the post out to the meta items, was the other just the reverse of that?

@rmccue
Copy link
Member Author

rmccue commented Apr 27, 2015

This is no longer [WIP] and is up for review.

One note: @danielbachhuber said above:

Rather than subclassing, let's pass $type to WP_JSON_Meta_Controller, similar to WP_JSON_Posts_Controller

Unlike the posts controller, we have two fundamentally different objects (posts and users, with potentially comments and terms) that have different permissions checks and such. For example, comment meta would need to check the comment and potentially also the parent post.

@WP-API/amigos #reviewmerge

@danielbachhuber
Copy link
Member

Unlike the posts controller, we have two fundamentally different objects (posts and users, with potentially comments and terms) that have different permissions checks and such.

Couldn't we have some conditional logic based on $type inside of the permissions callback?

Pages are fundamentally different than Posts, and we've accommodated them both just fine in the Posts controller.

@joehoyle thoughts?

@rmccue
Copy link
Member Author

rmccue commented Apr 27, 2015

Couldn't we have some conditional logic based on $type inside of the permissions callback?

We have a small amount right now, yeah (get_id_column), but I'm tempted to even move that to the subclasses.

Pages and posts are both fundamentally CPTs, so they follow a bunch of similar patterns. Both store meta in the database equally, both have the same system to check permissions, etc. Posts and users however are a fair bit different.

We could do it, but we'll end up with some kinda nasty conditionals in the permission checks. As is, the permission checks are essentially the only place we need to subclass right now, so I think it's fine as-is. We can always revisit and refactor if we need to when we add user meta.

rachelbaker added a commit that referenced this pull request Apr 27, 2015
Convert meta endpoints to new-style
@rachelbaker rachelbaker merged commit 5c14650 into develop Apr 27, 2015
@rachelbaker rachelbaker deleted the new-style-meta branch April 27, 2015 21:51
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.

Add New Style Meta Endpoints

5 participants