removes instanceof User check

This commit is contained in:
Godfrey M 2024-10-31 12:50:13 -07:00
parent e65942064e
commit 97a449e80e

View file

@ -73,7 +73,7 @@ class CheckoutableListener
* 2. The item has a EULA * 2. The item has a EULA
* 3. The item should send an email at check-in/check-out * 3. The item should send an email at check-in/check-out
*/ */
if ($notifiable instanceof User) {
if ($event->checkoutable->requireAcceptance() || $event->checkoutable->getEula() || if ($event->checkoutable->requireAcceptance() || $event->checkoutable->getEula() ||
(method_exists($event->checkoutable, 'checkin_email') && $event->checkoutable->checkin_email())) { (method_exists($event->checkoutable, 'checkin_email') && $event->checkoutable->checkin_email())) {
if (!empty($notifiable->email)) { if (!empty($notifiable->email)) {
@ -83,7 +83,7 @@ class CheckoutableListener
} }
Log::info('Sending email, Locale: ' . ($event->checkedOutTo->locale ?? 'default')); Log::info('Sending email, Locale: ' . ($event->checkedOutTo->locale ?? 'default'));
} }
}
// Send Webhook notification // Send Webhook notification
if ($this->shouldSendWebhookNotification()) { if ($this->shouldSendWebhookNotification()) {
Notification::route(Setting::getSettings()->webhook_selected, Setting::getSettings()->webhook_endpoint) Notification::route(Setting::getSettings()->webhook_selected, Setting::getSettings()->webhook_endpoint)
@ -145,13 +145,16 @@ class CheckoutableListener
* 3. The item should send an email at check-in/check-out * 3. The item should send an email at check-in/check-out
*/ */
if ($notifiable instanceof User && $notifiable->email != '') {
if ($event->checkoutable->requireAcceptance() || $event->checkoutable->getEula() || if ($event->checkoutable->requireAcceptance() || $event->checkoutable->getEula() ||
(method_exists($event->checkoutable, 'checkin_email') && $event->checkoutable->checkin_email())) { (method_exists($event->checkoutable, 'checkin_email') && $event->checkoutable->checkin_email())) {
Mail::to($notifiable)->cc($ccEmails)->send($mailable); if (!empty($notifiable->email)) {
Mail::to($notifiable)->cc($ccEmails)->send($mailable);
} else {
Mail::cc($ccEmails)->send($mailable);
}
Log::info('Sending email, Locale: ' . $event->checkedOutTo->locale); Log::info('Sending email, Locale: ' . $event->checkedOutTo->locale);
} }
}
// Send Webhook notification // Send Webhook notification
if ($this->shouldSendWebhookNotification()) { if ($this->shouldSendWebhookNotification()) {
Notification::route(Setting::getSettings()->webhook_selected, Setting::getSettings()->webhook_endpoint) Notification::route(Setting::getSettings()->webhook_selected, Setting::getSettings()->webhook_endpoint)