Skip to content

Commit

Permalink
A4A Client: Only show disconnect dialog during plugin deactivation wh…
Browse files Browse the repository at this point in the history
…en connected (#37337)

* Conditionally add the disconnect on deactivation handler

* changelog
  • Loading branch information
nateweller authored May 10, 2024
1 parent ede8fd8 commit 2d24fc4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Prevent disconnect dialog from displaying when site is already disconnected.


Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ public static function init() {
add_action( 'load-settings_page_' . AUTOMATTIC_FOR_AGENCIES_CLIENT_SLUG, array( static::class, 'load_scripts_styles' ) );

// Display a modal when trying to deactivate the plugin.
Deactivation_Handler::init( AUTOMATTIC_FOR_AGENCIES_CLIENT_SLUG, __DIR__ . '/admin/deactivation-dialog.php' );
$manager = new Connection_Manager( 'automattic-for-agencies-client' );
if ( $manager->is_connected() ) {
Deactivation_Handler::init( AUTOMATTIC_FOR_AGENCIES_CLIENT_SLUG, __DIR__ . '/admin/deactivation-dialog.php' );
}
}

/**
Expand Down

0 comments on commit 2d24fc4

Please sign in to comment.