A free open source IT asset/license management system
WIP
Marcus Moore68ef97572678
diff --git a/app/Listeners/CheckoutableListener.php b/app/Listeners/CheckoutableListener.phpindex cb0d2d1584..8c118b0ed0 100644--- a/app/Listeners/CheckoutableListener.php+++ b/app/Listeners/CheckoutableListener.php@@ -51,13 +51,11 @@ class CheckoutableListenerreturn;}- // @todo: remove this- // $shouldSendEmailNotifications = $this->shouldSendEmailNotifications($event->checkoutable);$shouldSendEmailToUser = $this->shouldSendEmailToUser($event->checkoutable);$shouldSendEmailToAlertAddress = $this->shouldSendEmailToAlertAddress();$shouldSendWebhookNotification = $this->shouldSendWebhookNotification();- if (!$shouldSendEmailToUser && !$shouldSendWebhookNotification) {+ if (!$shouldSendEmailToUser && !$shouldSendWebhookNotification && !$shouldSendEmailToAlertAddress) {return;}@@ -72,13 +70,13 @@ class CheckoutableListener// if user && cc: to user, cc adminif ($shouldSendEmailToUser && $shouldSendEmailToAlertAddress) {- $to[] = $notifiable->email;+ $to[] = $notifiable;$cc[] = $this->getFormattedAlertAddresses();}// if user && no cc: to userif ($shouldSendEmailToUser && !$shouldSendEmailToAlertAddress) {- $to[] = $notifiable->email;+ $to[] = $notifiable;}// if no user && cc: to admin@@ -87,7 +85,7 @@ class CheckoutableListener}try {- Mail::to($to)->cc($cc)->send($mailable);+ Mail::to(array_flatten($to))->cc(array_flatten($cc))->send($mailable);Log::info('Checkout Mail sent to checkout target');} catch (ClientException $e) {Log::debug("Exception caught during checkout email: " . $e->getMessage());diff --git a/tests/Feature/Notifications/Email/EmailNotificationsUponCheckoutTest.php b/tests/Feature/Notifications/Email/EmailNotificationsUponCheckoutTest.phpindex 02efb0c432..790e48a877 100644--- a/tests/Feature/Notifications/Email/EmailNotificationsUponCheckoutTest.php+++ b/tests/Feature/Notifications/Email/EmailNotificationsUponCheckoutTest.php@@ -89,16 +89,14 @@ class EmailNotificationsUponCheckoutTest extends TestCasepublic function test_sends_alert_email(){- $this->markTestIncomplete();-$this->settings->enableAdminCC('[email protected]');$this->category->update(['checkin_email' => true]);$this->fireCheckoutEvent();- Mail::assertSent(CheckoutAssetMail::class, function ($mail) {- return $mail->hasTo('[email protected]');+ Mail::assertSent(CheckoutAssetMail::class, function (CheckoutAssetMail $mail) {+ return $mail->hasCc('[email protected]');});}