From 13562511be4e0593cc51e3aad545358e13a94b6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Gangloff?= Date: Mon, 9 Dec 2024 15:10:19 +0100 Subject: [PATCH] fix: verify webhook DSN exists before send notif --- src/MessageHandler/SendDomainEventNotifHandler.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/MessageHandler/SendDomainEventNotifHandler.php b/src/MessageHandler/SendDomainEventNotifHandler.php index 4facc8e..bc68986 100644 --- a/src/MessageHandler/SendDomainEventNotifHandler.php +++ b/src/MessageHandler/SendDomainEventNotifHandler.php @@ -83,13 +83,17 @@ final readonly class SendDomainEventNotifHandler if (TriggerAction::SendEmail == $watchListTrigger->getAction()) { $this->mailer->send($notification->asEmailMessage($recipient)->getMessage()); } elseif (TriggerAction::SendChat == $watchListTrigger->getAction()) { + $webhookDsn = $watchList->getWebhookDsn(); + if (null === $webhookDsn || 0 === count($webhookDsn)) { + continue; + } $this->chatNotificationService->sendChatNotification($watchList, $notification); } - $this->statService->incrementStat('stats.alert.sent'); if ($this->influxdbEnabled) { - $this->influxdbService->addDomainNotificationPoint($domain, $watchListTrigger->getAction(), true); + $this->influxdbService->addDomainNotificationPoint($domain, TriggerAction::SendChat, true); } + $this->statService->incrementStat('stats.alert.sent'); } } }