Automattic / Automattic/jetpack
Json API should not filter "review" type comments from WPCOM_JSON_API_List_Comments_Endpoint
- Dominant language
- PHP
- Stars
- 1.8k
- Forks
- 898
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 774
Description
### Impacted plugin
Jetpack
### Steps to Reproduce
- In a site with Jetpack + Woo, add a few `review` type comments.
- When visiting wp-admin/ the comments count displayed will include those review type comments.
- However, when querying the JP API via the WPCOM api, for example via https://public-api.wordpress.com/rest/v1.1/sites/{SITE}/comments/, those `review` type comments will not be counted/returned.
### A clear and concise description of what you expected to happen.
- Review type comments should be counted/returned as other comments, as it happens on wp-admin.
- On calypso/atomic, there is a further discrepancy where the comment count (bubble next to the comments menu item) actually includes reviews, but the review comments aren't shown.
### What actually happened
Jetpack filters all sort of woo comment types [here](https://github.com/Automattic/jetpack/blob/e13487d0dbbe4c743739b6f1a3e37c143a8c2614/projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-list-comments-endpoint.php#L202)
While Woo already has a bunch of filters ([example](https://github.com/woocommerce/woocommerce/blob/a236bdca191c6c2b9d9a9391ba89a08c19534bc6/plugins/woocommerce/includes/class-wc-comments.php#L247)) to exclude 'order_note', 'webhook_delivery', and 'action_log' type comments, it explicitly doesn't exclude `review` and JP shouldn't do that.
### Other information
Reported by user in 4680406-zd-woothemes
### Operating System
_No response_
### OS Version
_No response_
### Browser
Chrome/Chromium
### Browser Version(s)
_No response_
Contributor guide
Research direction
Start in projects/plugins/jetpack/json-endpoints/class.wpcom-json-api-list-comments-endpoint.php at the linked filtering logic, then compare the WooCommerce exclusions in plugins/woocommerce/includes/class-wc-comments.php. Query the WPCOM comments endpoint with Jetpack and Woo review comments; done means review comments are counted and returned without restoring the explicitly excluded comment types.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100