-
Notifications
You must be signed in to change notification settings - Fork 846
Sites API: Return options for Jetpack blog requests #13844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sites API: Return options for Jetpack blog requests #13844
Conversation
|
Caution: This PR has changes that must be merged to WordPress.com |
|
Thank you for the great PR description! When this PR is ready for review, please apply the Scheduled Jetpack release: December 3, 2019. |
|
I haven't properly tested this yet, but it looks good. I thought I had mentioned this somewhere else, so apologies if I'm repeating myself, but I discovered that because of It's a separate issue, but we might want to consider whether this information should be returned for these requests. |
@pablinos Thanks for bringing this up. I'd like to handle that issue separately from this PR, since these changes are a bit challenging to test already, given how many different ways there are to call the endpoint and process the request. |
Yes, I think that's fair enough. My only concern would be if we start leaking extra information, but as we've discussed before, that shouldn't happen unless the blog token has been compromised. |
f9ba92e to
f56a525
Compare
|
creativecoder, Your synced wpcom patch D34564-code has been updated. |
jeherve
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be good to merge. 👍
|
Thanks for merging this @jeherve! I'm just a little slow in looping back to it. Taking care of the wpcom patch now. |
Changes proposed in this Pull Request:
edit_postscapability (subscriber users)Because this endpoint is currently using a
current_user_can( 'edit_posts' )capability check to determine whether to return site options, blog requests do not see most site options.Some site options that were added when decorating the request on wpcom still leaked through to subscriber level users, so this change also removes all site level options for those users.
Is this a new feature or does it add/remove features to an existing part of Jetpack?
See p1571157924035600-slack-jetpack-developers for context.
Testing instructions:
Testing this can be complex, because there are a lot of different ways the code is run on wpcom + Jetpack sites. I'd recommend the following testing methodology to verify the output.
Setup
developer.wordpress.com/consolewp shellfor your Jetpack development site and runecho wp_remote_retrieve_body( Automattic\Jetpack\Connection\Client::wpcom_json_api_request_as_blog( 'sites/{site_id}?force=wpcom') );(replacing the site_id with the id of your local Jetpack development site)Requests
/sites/{site}?force=wpcom/sites/{site}Proposed changelog entry for your changes:
as_blogrequest to/site/{site}