diff --git a/app/Http/Controllers/Account/AcceptanceController.php b/app/Http/Controllers/Account/AcceptanceController.php index 73e26422f6..f79ec1842f 100644 --- a/app/Http/Controllers/Account/AcceptanceController.php +++ b/app/Http/Controllers/Account/AcceptanceController.php @@ -248,15 +248,15 @@ class AcceptanceController extends Controller // Add the attachment for the signing user into the $data array $data['file'] = $pdf_filename; - + $locale = $assigned_user->locale; try { - $assigned_user->notify(new AcceptanceAssetAcceptedToUserNotification($data)); + $assigned_user->notify((new AcceptanceAssetAcceptedToUserNotification($data))->locale($locale)); } catch (\Exception $e) { Log::warning($e); } } try { - $acceptance->notify(new AcceptanceAssetAcceptedNotification($data)); + $acceptance->notify((new AcceptanceAssetAcceptedNotification($data))->locale(Setting::getSettings()->locale)); } catch (\Exception $e) { Log::warning($e); } diff --git a/app/Listeners/CheckoutableListener.php b/app/Listeners/CheckoutableListener.php index 7e289b19e6..9674bd63a3 100644 --- a/app/Listeners/CheckoutableListener.php +++ b/app/Listeners/CheckoutableListener.php @@ -96,7 +96,8 @@ class CheckoutableListener if (!empty($to)) { try { - Mail::to(array_flatten($to))->cc(array_flatten($cc))->send($mailable); + Mail::to(array_flatten($to))->send($mailable->locale($notifiable->locale)); + Mail::to(array_flatten($cc))->send($mailable->locale(Setting::getSettings()->locale)); Log::info('Checkout Mail sent to checkout target'); } catch (ClientException $e) { Log::debug("Exception caught during checkout email: " . $e->getMessage()); @@ -180,7 +181,8 @@ class CheckoutableListener try { if (!empty($to)) { - Mail::to(array_flatten($to))->cc(array_flatten($cc))->send($mailable); + Mail::to(array_flatten($to))->send($mailable->locale($notifiable->locale)); + Mail::to(array_flatten($cc))->send($mailable->locale(Setting::getSettings()->locale)); Log::info('Checkin Mail sent to CC addresses'); } } catch (ClientException $e) { diff --git a/tests/Feature/Checkouts/Ui/BulkAssetCheckoutTest.php b/tests/Feature/Checkouts/Ui/BulkAssetCheckoutTest.php index f05c4389e6..c525f763ad 100644 --- a/tests/Feature/Checkouts/Ui/BulkAssetCheckoutTest.php +++ b/tests/Feature/Checkouts/Ui/BulkAssetCheckoutTest.php @@ -58,7 +58,7 @@ class BulkAssetCheckoutTest extends TestCase $this->assertHasTheseActionLogs($asset, ['create', 'checkout']); //Note: '$this' gets auto-bound in closures, so this does work. }); - Mail::assertSent(CheckoutAssetMail::class, 2); + Mail::assertSent(CheckoutAssetMail::class, 4); Mail::assertSent(CheckoutAssetMail::class, function (CheckoutAssetMail $mail) { return $mail->hasTo('someone@example.com'); }); diff --git a/tests/Feature/Notifications/Email/EmailNotificationsToAdminAlertEmailUponCheckinTest.php b/tests/Feature/Notifications/Email/EmailNotificationsToAdminAlertEmailUponCheckinTest.php index 1bdbf0b673..cc9a6cb244 100644 --- a/tests/Feature/Notifications/Email/EmailNotificationsToAdminAlertEmailUponCheckinTest.php +++ b/tests/Feature/Notifications/Email/EmailNotificationsToAdminAlertEmailUponCheckinTest.php @@ -51,8 +51,12 @@ class EmailNotificationsToAdminAlertEmailUponCheckinTest extends TestCase $this->fireCheckInEvent($this->asset, $this->user); + Mail::assertSentCount(2); Mail::assertSent(CheckinAssetMail::class, function ($mail) { - return $mail->hasTo($this->user->email) && $mail->hasCc('cc@example.com'); + return $mail->hasTo($this->user->email); + }); + Mail::assertSent(CheckinAssetMail::class, function ($mail) { + return $mail->hasTo('cc@example.com'); }); } diff --git a/tests/Feature/Notifications/Email/EmailNotificationsToAdminAlertEmailUponCheckoutTest.php b/tests/Feature/Notifications/Email/EmailNotificationsToAdminAlertEmailUponCheckoutTest.php index d881ae7dab..3da0b21621 100644 --- a/tests/Feature/Notifications/Email/EmailNotificationsToAdminAlertEmailUponCheckoutTest.php +++ b/tests/Feature/Notifications/Email/EmailNotificationsToAdminAlertEmailUponCheckoutTest.php @@ -48,7 +48,7 @@ class EmailNotificationsToAdminAlertEmailUponCheckoutTest extends TestCase $this->fireCheckoutEvent(); Mail::assertSent(CheckoutAssetMail::class, function (CheckoutAssetMail $mail) { - return $mail->hasCc('cc@example.com'); + return $mail->hasTo('cc@example.com'); }); }