Skip to content

Commit

Permalink
SupportInteractions: Pass params on get (#40185)
Browse files Browse the repository at this point in the history
  • Loading branch information
heavyweight authored and matticbot committed Nov 14, 2024
1 parent e1fef65 commit 966f709
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 87 deletions.
58 changes: 29 additions & 29 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,13 @@ public function register_rest_route() {
* @param \WP_REST_Request $request The request sent to the API.
*/
public function get_support_interactions( \WP_REST_Request $request ) {
$support_interaction_id = isset( $request['support_interaction_id'] ) ? (int) $request['support_interaction_id'] : null;
$body = Client::wpcom_json_api_request_as_user( "/support-interactions/$support_interaction_id" );
if ( isset( $request['support_interaction_id'] ) ) {
$url = "/support-interactions/{$request['support_interaction_id']}";
} else {
$url = '/support-interactions/?' . http_build_query( stripslashes_deep( $request->get_params() ) );
}

$body = Client::wpcom_json_api_request_as_user( $url );

if ( is_wp_error( $body ) ) {
return $body;
Expand Down
Loading

0 comments on commit 966f709

Please sign in to comment.