From 82fbb38835262d28ef533d149520f15e8d5492aa Mon Sep 17 00:00:00 2001 From: adamsilverstein Date: Fri, 24 Oct 2025 10:58:20 -0600 Subject: [PATCH 1/3] try: add child note test --- .../rest-api/rest-comments-controller.php | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/phpunit/tests/rest-api/rest-comments-controller.php b/tests/phpunit/tests/rest-api/rest-comments-controller.php index e0868bbeca362..7bb9d3d1939b1 100644 --- a/tests/phpunit/tests/rest-api/rest-comments-controller.php +++ b/tests/phpunit/tests/rest-api/rest-comments-controller.php @@ -4069,4 +4069,38 @@ public function data_note_status_provider() { 'reopen' => array( 'reopen' ), ); } + + /** + * Test children link for note comment type. + * + * @ticket 64145 + */ + public function test_get_note_with_children_link() { + $comment_id_1 = self::factory()->comment->create( + array( + 'comment_approved' => 0, + 'comment_post_ID' => self::$post_id, + 'user_id' => self::$subscriber_id, + 'comment_type' => 'note', + ) + ); + + self::factory()->comment->create( + array( + 'comment_approved' => 0, + 'comment_parent' => $comment_id_1, + 'comment_post_ID' => self::$post_id, + 'user_id' => self::$subscriber_id, + 'comment_type' => 'note', + ) + ); + wp_set_current_user( self::$admin_id ); + $request = new WP_REST_Request( 'GET', sprintf( '/wp/v2/comments/%s', $comment_id_1 ) ); + $request->set_param( 'type', 'note' ); + $request->set_param( 'context', 'edit' ); + $response = rest_get_server()->dispatch( $request ); + $this->assertSame( 200, $response->get_status() ); + + $this->assertArrayHasKey( 'children', $response->get_links() ); + } } From b5fd3702eb3ebb46cd9a94bba110a90534b99c0a Mon Sep 17 00:00:00 2001 From: adamsilverstein Date: Fri, 24 Oct 2025 11:02:48 -0600 Subject: [PATCH 2/3] phpcbf --- tests/phpunit/tests/rest-api/rest-comments-controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/tests/rest-api/rest-comments-controller.php b/tests/phpunit/tests/rest-api/rest-comments-controller.php index 7bb9d3d1939b1..61fb2b3f2c0b9 100644 --- a/tests/phpunit/tests/rest-api/rest-comments-controller.php +++ b/tests/phpunit/tests/rest-api/rest-comments-controller.php @@ -4095,7 +4095,7 @@ public function test_get_note_with_children_link() { ) ); wp_set_current_user( self::$admin_id ); - $request = new WP_REST_Request( 'GET', sprintf( '/wp/v2/comments/%s', $comment_id_1 ) ); + $request = new WP_REST_Request( 'GET', sprintf( '/wp/v2/comments/%s', $comment_id_1 ) ); $request->set_param( 'type', 'note' ); $request->set_param( 'context', 'edit' ); $response = rest_get_server()->dispatch( $request ); From 183458092d073a143aff2fcb8aa810153321646a Mon Sep 17 00:00:00 2001 From: adamsilverstein Date: Sat, 25 Oct 2025 13:33:46 -0600 Subject: [PATCH 3/3] Ensure comments controller returns note type children --- .../rest-api/endpoints/class-wp-rest-comments-controller.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php index f4f6bdd1f1a54..7c53efebf66a9 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php @@ -1254,6 +1254,8 @@ protected function prepare_links( $comment ) { array( 'count' => true, 'orderby' => 'none', + 'type' => $comment->comment_type, + 'status' => 'all', ) );