diff --git a/app/Listeners/Database/SendSpeedtestThresholdNotification.php b/app/Listeners/Database/SendSpeedtestThresholdNotification.php index 4038b42b0..843b88a28 100644 --- a/app/Listeners/Database/SendSpeedtestThresholdNotification.php +++ b/app/Listeners/Database/SendSpeedtestThresholdNotification.php @@ -18,8 +18,6 @@ public function handle(SpeedtestCompleted $event): void { $notificationSettings = new NotificationSettings(); - $thresholdSettings = new ThresholdSettings(); - if (! $notificationSettings->database_enabled) { return; } @@ -28,6 +26,12 @@ public function handle(SpeedtestCompleted $event): void return; } + $thresholdSettings = new ThresholdSettings(); + + if (! $thresholdSettings->absolute_enabled) { + return; + } + if ($thresholdSettings->absolute_download > 0) { $this->absoluteDownloadThreshold(event: $event, thresholdSettings: $thresholdSettings); } diff --git a/app/Listeners/Discord/SendSpeedtestThresholdNotification.php b/app/Listeners/Discord/SendSpeedtestThresholdNotification.php index 82bf5708b..b535899a3 100644 --- a/app/Listeners/Discord/SendSpeedtestThresholdNotification.php +++ b/app/Listeners/Discord/SendSpeedtestThresholdNotification.php @@ -35,6 +35,10 @@ public function handle(SpeedtestCompleted $event): void $thresholdSettings = new ThresholdSettings(); + if (! $thresholdSettings->absolute_enabled) { + return; + } + $failed = []; if ($thresholdSettings->absolute_download > 0) { @@ -50,6 +54,8 @@ public function handle(SpeedtestCompleted $event): void } if (! count($failed)) { + Log::warning('Failed Discord thresholds not found, won\'t send notification.'); + return; } diff --git a/app/Listeners/Mail/SendSpeedtestThresholdNotification.php b/app/Listeners/Mail/SendSpeedtestThresholdNotification.php index 39c6e6e4b..9345d7501 100644 --- a/app/Listeners/Mail/SendSpeedtestThresholdNotification.php +++ b/app/Listeners/Mail/SendSpeedtestThresholdNotification.php @@ -35,6 +35,10 @@ public function handle(SpeedtestCompleted $event): void $thresholdSettings = new ThresholdSettings(); + if (! $thresholdSettings->absolute_enabled) { + return; + } + $failed = []; if ($thresholdSettings->absolute_download > 0) { @@ -50,6 +54,8 @@ public function handle(SpeedtestCompleted $event): void } if (! count($failed)) { + Log::warning('Failed mail thresholds not found, won\'t send notification.'); + return; } diff --git a/app/Listeners/Telegram/SendSpeedtestThresholdNotification.php b/app/Listeners/Telegram/SendSpeedtestThresholdNotification.php index be685fb9a..f3b4276b5 100644 --- a/app/Listeners/Telegram/SendSpeedtestThresholdNotification.php +++ b/app/Listeners/Telegram/SendSpeedtestThresholdNotification.php @@ -36,6 +36,10 @@ public function handle(SpeedtestCompleted $event): void $thresholdSettings = new ThresholdSettings(); + if (! $thresholdSettings->absolute_enabled) { + return; + } + $failed = []; if ($thresholdSettings->absolute_download > 0) { @@ -51,6 +55,8 @@ public function handle(SpeedtestCompleted $event): void } if (! count($failed)) { + Log::warning('Failed Telegram thresholds not found, won\'t send notification.'); + return; } diff --git a/app/Listeners/Webhook/SendSpeedtestThresholdNotification.php b/app/Listeners/Webhook/SendSpeedtestThresholdNotification.php index a1fb3840b..3cf66e460 100644 --- a/app/Listeners/Webhook/SendSpeedtestThresholdNotification.php +++ b/app/Listeners/Webhook/SendSpeedtestThresholdNotification.php @@ -37,6 +37,10 @@ public function handle(SpeedtestCompleted $event): void $thresholdSettings = new ThresholdSettings(); + if (! $thresholdSettings->absolute_enabled) { + return; + } + $failed = []; if ($thresholdSettings->absolute_download > 0) { @@ -52,6 +56,8 @@ public function handle(SpeedtestCompleted $event): void } if (! count($failed)) { + Log::warning('Failed webhook thresholds not found, won\'t send notification.'); + return; }