Override Jetpack connection data endpoint when Jetpack is not installed (#38987)
* Override /jetpack/v4/connection/data to return 404 to fix conflict with Android app flow * Add changelog * Override only for the mobile devices
This commit is contained in:
parent
b11b17c17c
commit
55280aea96
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: minor
|
||||||
|
Type: fix
|
||||||
|
|
||||||
|
Override /jetpack/v4/connection/data to return 404 to fix conflict with Android app flow
|
|
@ -11,6 +11,7 @@ defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
use ActionScheduler;
|
use ActionScheduler;
|
||||||
use Automattic\Jetpack\Connection\Manager;
|
use Automattic\Jetpack\Connection\Manager;
|
||||||
|
use Automattic\Jetpack\Constants;
|
||||||
use Automattic\WooCommerce\Admin\PluginsHelper;
|
use Automattic\WooCommerce\Admin\PluginsHelper;
|
||||||
use Automattic\WooCommerce\Admin\PluginsInstallLoggers\AsynPluginsInstallLogger;
|
use Automattic\WooCommerce\Admin\PluginsInstallLoggers\AsynPluginsInstallLogger;
|
||||||
use WC_REST_Data_Controller;
|
use WC_REST_Data_Controller;
|
||||||
|
@ -124,6 +125,29 @@ class OnboardingPlugins extends WC_REST_Data_Controller {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is a temporary solution to override /jetpack/v4/connection/data endpoint
|
||||||
|
* registered by Jetpack Connection when Jetpack is not installed.
|
||||||
|
*
|
||||||
|
* For more details, see https://github.com/woocommerce/woocommerce/issues/38979
|
||||||
|
*/
|
||||||
|
if ( Constants::get_constant( 'JETPACK__VERSION' ) === null && wp_is_mobile() ) {
|
||||||
|
register_rest_route(
|
||||||
|
'jetpack/v4',
|
||||||
|
'/connection/data',
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'methods' => 'GET',
|
||||||
|
'permission_callback' => '__return_true',
|
||||||
|
'callback' => function() {
|
||||||
|
return new WP_REST_Response( null, 404 );
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue