Fix notifications. Add message. Closes #2338

This commit is contained in:
James Brooks
2017-02-27 19:24:31 +00:00
parent 810e7d75ae
commit e156be6ce1
2 changed files with 8 additions and 5 deletions
@@ -78,6 +78,7 @@ class NewIncidentNotification extends Notification
->greeting(trans('notifications.incident.new.mail.greeting', ['app_name' => Config::get('setting.app_name')])) ->greeting(trans('notifications.incident.new.mail.greeting', ['app_name' => Config::get('setting.app_name')]))
->line($content) ->line($content)
->action(trans('notifications.incident.new.mail.action'), cachet_route('incident', [$this->incident])) ->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)])); ->line(trans('cachet.subscriber.unsubscribe', ['link' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code)]));
} }
@@ -121,7 +122,7 @@ class NewIncidentNotification extends Notification
return (new SlackMessage()) return (new SlackMessage())
->$status() ->$status()
->content($content) ->content($content)
->attachment(function ($attachment) use ($content) { ->attachment(function ($attachment) use ($content, $notifiable) {
$attachment->title(trans('notifications.incident.new.slack.title', [$this->incident->name])) $attachment->title(trans('notifications.incident.new.slack.title', [$this->incident->name]))
->timestamp($this->incident->getWrappedObject()->occurred_at) ->timestamp($this->incident->getWrappedObject()->occurred_at)
->fields(array_filter([ ->fields(array_filter([
@@ -70,8 +70,8 @@ class IncidentUpdatedNotification extends Notification
public function toMail($notifiable) public function toMail($notifiable)
{ {
$content = trans('notifications.incident.update.mail.content', [ $content = trans('notifications.incident.update.mail.content', [
'name' => $this->update->incident->name, 'name' => $this->update->incident->name,
'time' => $this->update->created_at_diff, 'time' => $this->update->created_at_diff,
]); ]);
return (new MailMessage()) return (new MailMessage())
@@ -82,6 +82,7 @@ class IncidentUpdatedNotification extends Notification
])) ]))
->line($content) ->line($content)
->action(trans('notifications.incident.update.mail.action'), cachet_route('incident', [$this->update->incident])) ->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)])); ->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) public function toSlack($notifiable)
{ {
$content = trans('notifications.incident.update.slack.content', [ $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'; $status = 'info';
@@ -127,7 +129,7 @@ class IncidentUpdatedNotification extends Notification
return (new SlackMessage()) return (new SlackMessage())
->$status() ->$status()
->content($content) ->content($content)
->attachment(function ($attachment) use ($content) { ->attachment(function ($attachment) use ($content, $notifiable) {
$attachment->title(trans('notifications.incident.update.slack.title', [ $attachment->title(trans('notifications.incident.update.slack.title', [
'name' => $this->update->incident->name, 'name' => $this->update->incident->name,
'new_status' => $this->update->human_status, 'new_status' => $this->update->human_status,