fix: verify webhook DSN exists before send notif

This commit is contained in:
Maël Gangloff
2024-12-09 15:10:19 +01:00
parent 1637d55d8e
commit 13562511be

View File

@@ -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');
}
}
}