From e156be6ce14ec5e88b8df95d141e5c2134b78df4 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Mon, 27 Feb 2017 19:24:31 +0000 Subject: [PATCH] Fix notifications. Add message. Closes #2338 --- app/Notifications/Incident/NewIncidentNotification.php | 3 ++- .../IncidentUpdate/IncidentUpdatedNotification.php | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/Notifications/Incident/NewIncidentNotification.php b/app/Notifications/Incident/NewIncidentNotification.php index 350905eb..0700f792 100644 --- a/app/Notifications/Incident/NewIncidentNotification.php +++ b/app/Notifications/Incident/NewIncidentNotification.php @@ -78,6 +78,7 @@ class NewIncidentNotification extends Notification ->greeting(trans('notifications.incident.new.mail.greeting', ['app_name' => Config::get('setting.app_name')])) ->line($content) ->action(trans('notifications.incident.new.mail.action'), cachet_route('incident', [$this->incident])) + ->line($this->incident->message) ->line(trans('cachet.subscriber.unsubscribe', ['link' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code)])); } @@ -121,7 +122,7 @@ class NewIncidentNotification extends Notification return (new SlackMessage()) ->$status() ->content($content) - ->attachment(function ($attachment) use ($content) { + ->attachment(function ($attachment) use ($content, $notifiable) { $attachment->title(trans('notifications.incident.new.slack.title', [$this->incident->name])) ->timestamp($this->incident->getWrappedObject()->occurred_at) ->fields(array_filter([ diff --git a/app/Notifications/IncidentUpdate/IncidentUpdatedNotification.php b/app/Notifications/IncidentUpdate/IncidentUpdatedNotification.php index f99d6e99..8d7c50f3 100644 --- a/app/Notifications/IncidentUpdate/IncidentUpdatedNotification.php +++ b/app/Notifications/IncidentUpdate/IncidentUpdatedNotification.php @@ -70,8 +70,8 @@ class IncidentUpdatedNotification extends Notification public function toMail($notifiable) { $content = trans('notifications.incident.update.mail.content', [ - 'name' => $this->update->incident->name, - 'time' => $this->update->created_at_diff, + 'name' => $this->update->incident->name, + 'time' => $this->update->created_at_diff, ]); return (new MailMessage()) @@ -82,6 +82,7 @@ class IncidentUpdatedNotification extends Notification ])) ->line($content) ->action(trans('notifications.incident.update.mail.action'), cachet_route('incident', [$this->update->incident])) + ->line($this->update->message) ->line(trans('cachet.subscriber.unsubscribe', ['link' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code)])); } @@ -111,7 +112,8 @@ class IncidentUpdatedNotification extends Notification public function toSlack($notifiable) { $content = trans('notifications.incident.update.slack.content', [ - 'name' => $this->update->incident->name, + 'name' => $this->update->incident->name, + 'new_status' => $this->update->human_status, ]); $status = 'info'; @@ -127,7 +129,7 @@ class IncidentUpdatedNotification extends Notification return (new SlackMessage()) ->$status() ->content($content) - ->attachment(function ($attachment) use ($content) { + ->attachment(function ($attachment) use ($content, $notifiable) { $attachment->title(trans('notifications.incident.update.slack.title', [ 'name' => $this->update->incident->name, 'new_status' => $this->update->human_status,