Automattic / Automattic/jetpack
API: Remove IS_WPCOM conditional before wpcom_json_api_request_as_blog
- Dominant language
- PHP
- Stars
- 1.8k
- Forks
- 898
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 774
Description
Now that `wpcom_json_api_request_as_blog` contains an abstraction to call the WP.com API directly when running on WP.com we no longer need to add `IS_WPCOM` conditionals before calling `wpcom_json_api_request_as_blog`. Instead we can simply remove all of the `IS_WPCOM` code block and call `wpcom_json_api_request_as_blog` in both environments.
I have managed to find 4 instances in the code where this needs updating:
- [ ] [class-jetpack-instagram-gallery-helper.php](https://github.com/Automattic/jetpack/blob/a1fe6f0b03ea68fb5e0eed1e22d585e2351b2a06/_inc/lib/class-jetpack-instagram-gallery-helper.php#L29)
- [ ] [class-wpcom-rest-api-v2-endpoint-mailchimp.php ](https://github.com/Automattic/jetpack/blob/092d9af6c96384083ae509741be77a8db9346721/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-mailchimp.php#L118)
- [ ] [class-jetpack-instagram-widget.php](https://github.com/Automattic/jetpack/blob/8ab0362810c20f6dec9f269d0d4fa3aa3dc82f0e/modules/widgets/class-jetpack-instagram-widget.php#L171)
- [ ] [class-jetpack-tweetstorm-helper.php](https://github.com/Automattic/jetpack/blob/9a437395f0d2f8248bea436faacd8445e71de846/_inc/lib/class-jetpack-tweetstorm-helper.php#L231)
See p7H4VZ-2LY-p2 and #15468 for details.
Contributor guide
Research direction
Review the four named files: class-jetpack-instagram-gallery-helper.php, class-wpcom-rest-api-v2-endpoint-mailchimp.php, class-jetpack-instagram-widget.php, and class-jetpack-tweetstorm-helper.php. In each location, remove the IS_WPCOM conditional around wpcom_json_api_request_as_blog and call it in both environments. Done means all four instances use the shared abstraction without the conditional blocks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- api, backend-api-design
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100