Skip to content

Commit f49831f

Browse files
committed
Fix issues from code review
- Add backslash to @return WP_REST_Response types - Add fields parameter to get_users for performance - Add version 2.2 to test coverage
1 parent fd8d381 commit f49831f

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

includes/controller/class-nodeinfo.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ protected function get_versions() {
8383
/**
8484
* Retrieves the discovery document.
8585
*
86-
* @return WP_REST_Response The response object.
86+
* @return \WP_REST_Response The response object.
8787
*/
8888
public function get_discovery() {
8989
$links = array();
@@ -114,7 +114,7 @@ public function get_discovery() {
114114
* Retrieves NodeInfo for a specific version.
115115
*
116116
* @param \WP_REST_Request $request The request object.
117-
* @return WP_REST_Response The response object.
117+
* @return \WP_REST_Response The response object.
118118
*/
119119
public function get_item( $request ) {
120120
$version = $request->get_param( 'version' );

includes/controller/class-nodeinfo2.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public function get_item( $request ) {
6363
$users = \get_users(
6464
array(
6565
'capability__in' => array( 'publish_posts' ),
66+
'fields' => 'ID',
6667
)
6768
);
6869

tests/phpunit/tests/class-test-nodeinfo-endpoint.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function test_discovery_contains_all_versions() {
9292
$response = $this->server->dispatch( $request );
9393
$data = $response->get_data();
9494

95-
$versions = array( '1.0', '1.1', '2.0', '2.1' );
95+
$versions = array( '1.0', '1.1', '2.0', '2.1', '2.2' );
9696
$links = $data['links'];
9797

9898
foreach ( $versions as $version ) {

0 commit comments

Comments
 (0)