API: Add likes and sharing settings to the REST API Post response#11196
API: Add likes and sharing settings to the REST API Post response#11196
Conversation
|
D23504-code. (newly created revision) |
|
Looks great, works for me! 👍 |
|
@kwight @codebykat which endpoints are we testing against? relative to the site, or public.api? Any other testing instructions? For example, I used Jetpack Beta to test this but see: |
|
Hmm. I tried it on jurassic.ninja and the new @gwwar Maybe you need to have the Likes module activated? |
|
Ahh okay confirmed you have to have Likes enabled in the Jetpack Settings or it won't load the module (which makes sense): So. Now there's some weirdness, because it doesn't load if you toggle Sharing Buttons and not likes. But on the WPCOM side, both of these are handled in the Likes plugin; on the Jetpack side, the sharing stuff is overridden when Sharedaddy loads. Let me think about how best to handle this. |
|
Thank you for the great PR description! When this PR is ready for review, please apply the Scheduled Jetpack release: February 5, 2019. |
|
Okay - Updated to register the meta within the appropriate module. This works correctly on WPCOM as well because Now when you test on the v2 API, you should see the With Likes enabled, With sharing buttons toggled on, And when they're both enabled, you should see both: Also worth noting These meta are confusingly named. A post with Likes disabled will have |
|
Updated! Thanks @jeherve 😄 |
|
@gwwar Just want to double-check that you're able to verify functionality with the modules enabled? |
|
For testing purposes we can use this link: https://jurassic.ninja/create/?jetpack-beta&branch=add/enable-likes-and-sharing-postmeta-in-api&wp-debug-log
cc @codebykat if you find weird behavior like
#11196 (comment) please update the top summary with new testing instructions. I think the behavior is okay here, I'd prefer if we could write up the expected permutations so folks can manually verify. |
|
Updated the summary and toggled back to Needs Review. I think we just need sign-off from someone on the Jetpack side. |
jeherve
left a comment
There was a problem hiding this comment.
Everything looks good now. Merging.









This is necessary groundwork to support migrating the Likes and Sharing metabox to Gutenberg. See Automattic/wp-calypso#29744 for context.
Changes proposed in this Pull Request:
register_metawithshow_in_rest=>trueforswitch_like_statusandsharing_disabled.Testing instructions:
switch_like_statusandsharing_disabledshow under the meta keys:Note: These meta are confusingly named. A post with Likes disabled will have switch_like_status set to FALSE (assuming Likes are enabled on posts by default). A post with Sharing Buttons enabled will have sharing_disabled set to FALSE.
For the purposes of this PR, if these keys show up in the API, the values don't matter that much, as this simply exposes the meta saved on the post.
Proposed changelog entry for your changes: