Skip to content

Commit

Permalink
fixes general webhook not firing
Browse files Browse the repository at this point in the history
  • Loading branch information
Godmartinz committed Dec 2, 2024
1 parent a7d5b39 commit 99464fc
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions app/Listeners/CheckoutableListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
Expand Down Expand Up @@ -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));
}
}
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 99464fc

Please sign in to comment.