diff --git a/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-send-email-preview.php b/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-send-email-preview.php index ee60837980375..4fdeccba9312b 100644 --- a/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-send-email-preview.php +++ b/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-send-email-preview.php @@ -40,8 +40,8 @@ public function __construct() { */ public function register_routes() { $options = array( - 'show_in_index' => true, - 'methods' => 'POST', + 'show_in_index' => true, + 'methods' => 'POST', // if this is not a wpcom site, we need to proxy the request to wpcom 'callback' => ( ( new Host() )->is_wpcom_simple() ) ? array( $this, 'send_email_preview' ) : array( $this, 'proxy_request_to_wpcom_as_user' ), 'permission_callback' => array( $this, 'permissions_check' ), diff --git a/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/trait-wpcom-rest-api-proxy-request-trait.php b/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/trait-wpcom-rest-api-proxy-request-trait.php index 1a6197c074aec..8d6d79d74fe3b 100644 --- a/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/trait-wpcom-rest-api-proxy-request-trait.php +++ b/projects/plugins/jetpack/_inc/lib/core-api/wpcom-endpoints/trait-wpcom-rest-api-proxy-request-trait.php @@ -8,10 +8,6 @@ */ use Automattic\Jetpack\Connection\Client; -<<<<<<< HEAD -======= -use Automattic\Jetpack\Connection\Manager; ->>>>>>> 6634c6eabe ([not verified] Add Send Email Preview endpoint) use Automattic\Jetpack\Status\Visitor; trait WPCOM_REST_API_Proxy_Request_Trait { @@ -24,11 +20,7 @@ trait WPCOM_REST_API_Proxy_Request_Trait { * * @return mixed|WP_Error Response from wpcom servers or an error. */ -<<<<<<< HEAD public function proxy_request_to_wpcom_as_user( $request, $path = '' ) { -======= - public function proxy_request_to_wpcom( $request, $path = '' ) { ->>>>>>> 6634c6eabe ([not verified] Add Send Email Preview endpoint) $blog_id = \Jetpack_Options::get_option( 'id' ); $path = '/sites/' . rawurldecode( $blog_id ) . rawurldecode( $this->rest_base ) . ( $path ? '/' . rawurldecode( $path ) : '' ); $api_url = add_query_arg( $request->get_query_params(), $path ); @@ -41,14 +33,7 @@ public function proxy_request_to_wpcom( $request, $path = '' ) { 'method' => $request->get_method(), ); -<<<<<<< HEAD $response = Client::wpcom_json_api_request_as_user( $api_url, $this->version, $request_options, $request->get_body(), $this->base_api_path ); -======= - // Prefer request as user, if possible. Fall back to blog request to show prompt data for unconnected users. - $response = ( ( new Manager() )->is_user_connected() ) - ? Client::wpcom_json_api_request_as_user( $api_url, $this->version, array( $request_options ), $request->get_body(), $this->base_api_path ) - : Client::wpcom_json_api_request_as_blog( $api_url, $this->version, array( $request_options ), $request->get_body(), $this->base_api_path ); ->>>>>>> 6634c6eabe ([not verified] Add Send Email Preview endpoint) if ( is_wp_error( $response ) ) { return $response;