Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Do not call build_connect_url on page load if the current user is con…
…nected
  • Loading branch information
dereksmart committed Sep 14, 2019
commit 16968a61c9df4b51821dbecb208c38b4946e1a46
6 changes: 4 additions & 2 deletions _inc/lib/admin-pages/class.jetpack-react-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ function get_initial_state() {
require_once JETPACK__PLUGIN_DIR . 'class.jetpack-affiliate.php';
}

$current_user_data = jetpack_current_user_data();

return array(
'WP_API_root' => esc_url_raw( rest_url() ),
'WP_API_nonce' => wp_create_nonce( 'wp_rest' ),
Expand All @@ -236,7 +238,7 @@ function get_initial_state() {
'isInIdentityCrisis' => Jetpack::validate_sync_error_idc_option(),
'sandboxDomain' => JETPACK__SANDBOX_DOMAIN,
),
'connectUrl' => Jetpack::init()->build_connect_url( true, false, false ),
'connectUrl' => $current_user_data['isConnected'] == false ? Jetpack::init()->build_connect_url( true, false, false ) : '',
'dismissedNotices' => $this->get_dismissed_jetpack_notices(),
'isDevVersion' => Jetpack::is_development_version(),
'currentVersion' => JETPACK__VERSION,
Expand All @@ -258,7 +260,7 @@ function get_initial_state() {
'settings' => $this->get_flattened_settings( $modules ),
'userData' => array(
// 'othersLinked' => Jetpack::get_other_linked_admins(),
'currentUser' => jetpack_current_user_data(),
'currentUser' => $current_user_data,
),
'siteData' => array(
'icon' => has_site_icon()
Expand Down