From 99464fcd8639ed385556bcb1aa7b395e083ffbd4 Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Mon, 2 Dec 2024 10:19:24 -0800 Subject: [PATCH] fixes general webhook not firing --- app/Listeners/CheckoutableListener.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/Listeners/CheckoutableListener.php b/app/Listeners/CheckoutableListener.php index 145abb168733..ce3299e7d160 100644 --- a/app/Listeners/CheckoutableListener.php +++ b/app/Listeners/CheckoutableListener.php @@ -100,7 +100,7 @@ public function onCheckedOut($event) $notification = new TeamsNotification(Setting::getSettings()->webhook_endpoint); $notification->success()->sendMessage($message[0], $message[1]); // Send the message to Microsoft Teams } else { - Notification::route(Setting::getSettings()->webhook_selected, Setting::getSettings()->webhook_endpoint) + Notification::route($this->webhookSelected(), Setting::getSettings()->webhook_endpoint) ->notify($this->getCheckoutNotification($event, $acceptance)); } } @@ -182,7 +182,7 @@ public function onCheckedIn($event) $notification = new TeamsNotification(Setting::getSettings()->webhook_endpoint); $notification->success()->sendMessage($message[0], $message[1]); // Send the message to Microsoft Teams } else { - Notification::route(Setting::getSettings()->webhook_selected, Setting::getSettings()->webhook_endpoint) + Notification::route($this->webhookSelected(), Setting::getSettings()->webhook_endpoint) ->notify($this->getCheckinNotification($event)); } } @@ -310,6 +310,13 @@ private function getNotifiables($event){ return $event->checkedOutTo?->email ?? ''; } } + private function webhookSelected(){ + if(Setting::getSettings()->webhook_selected === 'slack' || Setting::getSettings()->webhook_selected === 'general'){ + return 'slack'; + } + + return Setting::getSettings()->webhook_selected; + } /** * Register the listeners for the subscriber.