[wp-trac] [WordPress Trac] #41821: REST API: Add support for threaded comments
WordPress Trac
noreply at wordpress.org
Thu Jul 12 18:53:21 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
----------------------------------------+-----------------------------
Comment (by brgweb):
Thanks for the review! I've uplodaded another diff.
Replying to [comment:5 birgire]:
> 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?
I believe that I've changed the working copy during tests and was with a
stable version of WordPress. It's fixed now.
> - Is there any need for a {{{check_read_permission()}}} on the children,
as seen [https://github.com/BE-Webdesign/WP-
API/commit/5a00df20c0df2a11c8266b3a6474f74f308b7b6e here]?
I've added this check in the new patch.
> - 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 :)
It implements the threaded array in WP_Comment_Query but it outputs a flat
array. Working with threaded in the query made the code smaller and the
implementation easier. For REST API json responses, I don't think there's
a use for the threaded output (maybe I'm wrong :) )
> - We should consider unit tests for this support.
> - Current unit tests fail and need to be updated.
I'd like to help with unit tests too. I will work on it.
> - There are some issues regarding WordPress Code Standard, resulting in
a larger diff file.
Older version of the file and editor messing with spaces and tabs. Fixed
in v2.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41821#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list