[wp-trac] [WordPress Trac] #41821: REST API: Add support for threaded comments
WordPress Trac
noreply at wordpress.org
Thu Jul 12 13:33:58 UTC 2018
#41821: REST API: Add support for threaded comments
----------------------------------------+-----------------------------
Reporter: rmccue | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: REST API | Version: 4.7
Severity: normal | Resolution:
Keywords: has-patch needs-unit-tests | Focuses: rest-api
----------------------------------------+-----------------------------
Changes (by birgire):
* keywords: has-patch => has-patch needs-unit-tests
Comment:
Replying to [comment:4 brgweb]:
> @birgire I've added a diff to this ticket that enables threaded comments
in rest api.
>
> It adds a boolean query parameter "hierarchical". Instead of passing
"hierarchical" straight to WP_Comment_Query, it retrieves only top level
comments (or just the first level if "parent" is set) and retrieve
children inside prepare_items_for_response method.
>
> I've tested with fake data and in a production environment and it worked
as expected.
>
great, thanks for the patch
Few notes on [attachment:"41821.diff"]:
- It seems to change the dynamic fields support in
{{{WP_REST_Comments_Controller::prepare_item_for_response()}}}, so the
{{{_fields}}} parameter is not working on the comment children. See
[43087]. Are you working with the latest trunk?
- Is there any need for a {{{check_read_permission()}}} on the children,
as seen [https://github.com/BE-Webdesign/WP-
API/commit/5a00df20c0df2a11c8266b3a6474f74f308b7b6e here]?
- It seems to implement the {{{'hierarchical' => 'threaded'}}} according
the children tree output response, not the {{{'hierarchical' => true}}}
for a flat array? I might be misunderstanding the patch and the ticket's
description though :)
- We should consider unit tests for this support.
- Current unit tests fail and need to be updated.
- There are some issues regarding WordPress Code Standard, resulting in a
larger diff file.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41821#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list