From 8707ee5521a46214e239723d731d482fa51ed8fc Mon Sep 17 00:00:00 2001 From: David Cramer Date: Tue, 19 Jan 2021 12:01:16 +0200 Subject: [PATCH 1/2] add check to see if sync is empty --- php/ui/component/class-sync.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/ui/component/class-sync.php b/php/ui/component/class-sync.php index 1e5814779..f8a683210 100644 --- a/php/ui/component/class-sync.php +++ b/php/ui/component/class-sync.php @@ -45,7 +45,7 @@ protected function status( $struct ) { $icon = 'dashicons-yes-alt'; $state_text = __( 'All assets are synced', 'cloudinary' ); - if ( $this->setting->get_param( 'queue' )->is_enabled() ) { + if ( ! empty( $to_sync ) && $this->setting->get_param( 'queue' )->is_enabled() ) { $state = 'notification-syncing'; $icon = 'dashicons-update'; $state_text = __( 'Syncing now', 'cloudinary' ); From 75830745f5ce72f5d00b5860bd18ceb60fe1cdab Mon Sep 17 00:00:00 2001 From: David Cramer Date: Tue, 19 Jan 2021 13:30:24 +0200 Subject: [PATCH 2/2] use queue_status --- php/sync/class-sync-queue.php | 3 ++- php/ui/component/class-sync.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/php/sync/class-sync-queue.php b/php/sync/class-sync-queue.php index c15301932..41f8774d3 100644 --- a/php/sync/class-sync-queue.php +++ b/php/sync/class-sync-queue.php @@ -101,7 +101,8 @@ public function setup() { * @return bool */ public function is_enabled() { - return $this->is_running(); + $status = $this->get_queue_status(); + return $status['is_running']; } /** diff --git a/php/ui/component/class-sync.php b/php/ui/component/class-sync.php index f8a683210..1e5814779 100644 --- a/php/ui/component/class-sync.php +++ b/php/ui/component/class-sync.php @@ -45,7 +45,7 @@ protected function status( $struct ) { $icon = 'dashicons-yes-alt'; $state_text = __( 'All assets are synced', 'cloudinary' ); - if ( ! empty( $to_sync ) && $this->setting->get_param( 'queue' )->is_enabled() ) { + if ( $this->setting->get_param( 'queue' )->is_enabled() ) { $state = 'notification-syncing'; $icon = 'dashicons-update'; $state_text = __( 'Syncing now', 'cloudinary' );