clean up variables

This commit is contained in:
Godfrey M 2024-09-18 16:19:35 -07:00
parent c40209f500
commit 4ff5fc1ff9

View file

@ -50,7 +50,7 @@ class CheckoutableListener
foreach ($notifiables as $notifiable) { foreach ($notifiables as $notifiable) {
if ($notifiable instanceof User && $notifiable->email != '') { if ($notifiable instanceof User && $notifiable->email != '') {
if (! $event->checkedOutTo->locale){ if (! $event->checkedOutTo->locale){
Notification::locale(Setting::getSettings()->locale)->send($notifiables, $this->getCheckoutNotification($event, $acceptance)); Notification::locale(Setting::getSettings()->locale)->send($notifiable, $this->getCheckoutNotification($event, $acceptance));
} }
else { else {
Notification::send($notifiable, $this->getCheckoutNotification($event, $acceptance)); Notification::send($notifiable, $this->getCheckoutNotification($event, $acceptance));
@ -63,7 +63,7 @@ class CheckoutableListener
// Slack doesn't include the URL in its messaging format, so this is needed to hit the endpoint // Slack doesn't include the URL in its messaging format, so this is needed to hit the endpoint
if (Setting::getSettings()->webhook_selected === 'slack' || Setting::getSettings()->webhook_selected === 'general') { if (Setting::getSettings()->webhook_selected === 'slack' || Setting::getSettings()->webhook_selected === 'general') {
Notification::route('slack', Setting::getSettings()->webhook_endpoint) Notification::route('slack', Setting::getSettings()->webhook_endpoint)
->notify($this->getCheckoutNotification($event)); ->notify($this->getCheckoutNotification($event, $acceptance));
} else { } else {
Notification::route(Setting::getSettings()->webhook_selected, Setting::getSettings()->webhook_endpoint) Notification::route(Setting::getSettings()->webhook_selected, Setting::getSettings()->webhook_endpoint)
->notify($this->getCheckoutNotification($event, $acceptance)); ->notify($this->getCheckoutNotification($event, $acceptance));
@ -102,17 +102,17 @@ class CheckoutableListener
} }
} }
} }
$acceptance = $this->getCheckoutAcceptance($event);
$notifiables = $this->getNotifiables($event); $notifiables = $this->getNotifiables($event);
// Send email notifications // Send email notifications
try { try {
foreach ($notifiables as $notifiable) { foreach ($notifiables as $notifiable) {
if ($notifiable instanceof User && $notifiable->email != '') { if ($notifiable instanceof User && $notifiable->email != '') {
if (! $event->checkedOutTo->locale){ if (! $event->checkedOutTo->locale){
Notification::locale(Setting::getSettings()->locale)->send($notifiables, $this->getCheckoutNotification($event, $acceptance)); Notification::locale(Setting::getSettings()->locale)->send($notifiable, $this->getCheckoutNotification($event, $acceptance));
} }
else { else {
Notification::send($notifiable, $this->getCheckinNotification($event, $acceptance)); Notification::send($notifiable, $this->getCheckinNotification($event));
} }
} }
} }
@ -124,7 +124,7 @@ class CheckoutableListener
->notify($this->getCheckinNotification($event)); ->notify($this->getCheckinNotification($event));
} else { } else {
Notification::route(Setting::getSettings()->webhook_selected, Setting::getSettings()->webhook_endpoint) Notification::route(Setting::getSettings()->webhook_selected, Setting::getSettings()->webhook_endpoint)
->notify($this->getCheckinNotification($event, $acceptance)); ->notify($this->getCheckinNotification($event));
} }
} }