Closed fgiannar closed 15 hours ago
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
To test on WoA, go to the Plugins menu on a WordPress.com Simple site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin, and enable the update/forward-wpcom-request-trait
branch.
To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/forward-wpcom-request-trait
Interested in more tips and information?
jetpack rsync
command to sync your changes to a WoA dev blog.Thank you for your PR!
When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation :robot:
The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.
Follow this PR Review Process:
Still unsure? Reach out in #jetpack-developers for guidance!
Jetpack plugin:
The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.
This PR refactors the existing
WPCOM_REST_API_Proxy_Request_Trait
so that it can be used by any shared endpoint (between self-hosted and Simple sites) that needs to forward the request to WPCOM when it runs on the Jetpack end.It also refactors two existing endpoints to use the trait and introduces unit tests for both:
WP_Test_WPCOM_REST_API_V3_Endpoint_Blogging_Prompts
WPCOM_REST_API_V2_Endpoint_Memberships
Proposed changes:
WPCOM_REST_API_Proxy_Request_Trait
:proxy_request_to_wpcom
to allow falling back to using the Site-level Connection if the current user is not connectedproxy_request_to_wpcom_as_user
for proxying requests to WPCOM on behalf of the current userproxy_request_to_wpcom_as_blog
for proxying requests to WPCOM using the Site-level ConnectionWP_Test_WPCOM_REST_API_V3_Endpoint_Blogging_Prompts
:WPCOM_REST_API_Proxy_Request_Trait
traitWPCOM_REST_API_V2_Endpoint_Memberships
:WPCOM_REST_API_Proxy_Request_Trait
traitOther information:
Jetpack product discussion
p1730895681631659-slack-C05PV073SG3
Does this pull request change what data or activity we track or use?
No
Testing instructions:
bin/jetpack-downloader test jetpack update/forward-wpcom-request-trait