Merge pull request #17713 from Godmartinz/fix-localization-for-email-notifications
Adds #5554 locale for acceptance notifications and checkin/out emails
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user