diff --git a/projects/plugins/automattic-for-agencies-client/changelog/fix-a4a-remove-disconnect-prompt-when-disconnected b/projects/plugins/automattic-for-agencies-client/changelog/fix-a4a-remove-disconnect-prompt-when-disconnected new file mode 100644 index 0000000000000..6bd33d61c3091 --- /dev/null +++ b/projects/plugins/automattic-for-agencies-client/changelog/fix-a4a-remove-disconnect-prompt-when-disconnected @@ -0,0 +1,5 @@ +Significance: patch +Type: changed +Comment: Prevent disconnect dialog from displaying when site is already disconnected. + + diff --git a/projects/plugins/automattic-for-agencies-client/src/class-automattic-for-agencies-client.php b/projects/plugins/automattic-for-agencies-client/src/class-automattic-for-agencies-client.php index 6b442857eb72e..a03e498e44c39 100644 --- a/projects/plugins/automattic-for-agencies-client/src/class-automattic-for-agencies-client.php +++ b/projects/plugins/automattic-for-agencies-client/src/class-automattic-for-agencies-client.php @@ -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' ); + } } /**