Fixes #705 and only send emails for public incidents.
This commit is contained in:
@@ -67,23 +67,27 @@ class SendIncidentEmailNotificationHandler
|
|||||||
{
|
{
|
||||||
$data = $this->presenter->decorate($event->incident);
|
$data = $this->presenter->decorate($event->incident);
|
||||||
|
|
||||||
foreach ($this->subscriber->all() as $subscriber) {
|
// Only send emails for public incidents.
|
||||||
$mail = [
|
if ($event->incident->visible === 1) {
|
||||||
'email' => $subscriber->email,
|
foreach ($this->subscriber->all() as $subscriber) {
|
||||||
'subject' => 'New incident reported.',
|
$mail = [
|
||||||
'status' => $data->humanStatus,
|
'email' => $subscriber->email,
|
||||||
'htmlContent' => $data->formattedMessage,
|
'subject' => 'New incident reported.',
|
||||||
'textContent' => $data->message,
|
'status' => $data->humanStatus,
|
||||||
'token' => $subscriber->token,
|
'htmlContent' => $data->formattedMessage,
|
||||||
'unsubscribeLink' => route('unsubscribe', ['code' => $subscriber->token]),
|
'textContent' => $data->message,
|
||||||
];
|
'token' => $subscriber->token,
|
||||||
|
'unsubscribeLink' => route('unsubscribe', ['code' => $subscriber->token]),
|
||||||
|
'appUrl' => env('APP_URL'),
|
||||||
|
];
|
||||||
|
|
||||||
$this->mailer->queue([
|
$this->mailer->queue([
|
||||||
'html' => 'emails.incidents.new-html',
|
'html' => 'emails.incidents.new-html',
|
||||||
'text' => 'emails.incidents.new-text',
|
'text' => 'emails.incidents.new-text',
|
||||||
], $mail, function (Message $message) use ($mail) {
|
], $mail, function (Message $message) use ($mail) {
|
||||||
$message->to($mail['email'])->subject($mail['subject']);
|
$message->to($mail['email'])->subject($mail['subject']);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ class SendMaintenanceEmailNotificationHandler
|
|||||||
'textContent' => $data->message,
|
'textContent' => $data->message,
|
||||||
'token' => $subscriber->token,
|
'token' => $subscriber->token,
|
||||||
'unsubscribeLink' => route('unsubscribe', ['code' => $subscriber->token]),
|
'unsubscribeLink' => route('unsubscribe', ['code' => $subscriber->token]),
|
||||||
|
'appUrl' => env('APP_URL'),
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->mailer->queue([
|
$this->mailer->queue([
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ class SendSubscriberVerificationEmailHandler
|
|||||||
'email' => $event->subscriber->email,
|
'email' => $event->subscriber->email,
|
||||||
'subject' => 'Confirm your subscription.',
|
'subject' => 'Confirm your subscription.',
|
||||||
'link' => route('subscribe-verify', ['code' => $event->subscriber->verify_code]),
|
'link' => route('subscribe-verify', ['code' => $event->subscriber->verify_code]),
|
||||||
|
'appUrl' => env('APP_URL'),
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->mailer->queue([
|
$this->mailer->queue([
|
||||||
|
|||||||
Reference in New Issue
Block a user