Skip to content

Commit

Permalink
Search: Fix search on private WordPress.com-on-Atomic sites (#24099)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsnmoon committed May 3, 2022
1 parent 799a96a commit f018777
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Search: Fix search for private WoA sites
2 changes: 1 addition & 1 deletion projects/packages/search/src/class-rest-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public function get_search_results( $request ) {
$request->get_query_params(),
sprintf( '/sites/%d/search', absint( $blog_id ) )
);
$response = Client::wpcom_json_api_request_as_user( $path, '1.3', array(), null, 'rest' );
$response = Client::wpcom_json_api_request_as_blog( $path, '1.3', array(), null, 'rest' );
return rest_ensure_response( $this->make_proper_response( $response ) );
}

Expand Down
2 changes: 1 addition & 1 deletion projects/packages/search/src/instant-search/lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ export function search( options, requestId ) {
// "Private" Jetpack sites are not yet supported.
const urlForPublicApi = `https://public-api.wordpress.com/rest/v1.3${ pathForPublicApi }`;
const urlForWpcomOrigin = `${ homeUrl }/wp-json/wpcom-origin/v1.3${ pathForPublicApi }`;
const urlForAtomicOrigin = `${ apiRoot }wpcom/v2/search?${ queryString }`;
const urlForAtomicOrigin = `${ apiRoot }jetpack/v4/search?${ queryString }`;
let url = urlForPublicApi;
if ( isPrivateSite && isWpcom ) {
url = urlForWpcomOrigin;
Expand Down

0 comments on commit f018777

Please sign in to comment.