From 18219bf3287dbf099f6d56edde03ed05e72a8e6c Mon Sep 17 00:00:00 2001 From: James Wilson Date: Wed, 10 Oct 2018 14:00:51 +0100 Subject: [PATCH 1/3] Fixed #3101 --- .../ComponentStatusChangedNotification.php | 15 +++++++----- .../IncidentUpdatedNotification.php | 24 ++++++++++--------- .../Schedule/NewScheduleNotification.php | 13 ++++++---- .../notifications/component/update.blade.php | 11 +++++++++ .../notifications/incident/update.blade.php | 11 +++++++++ .../notifications/schedule/new.blade.php | 11 +++++++++ 6 files changed, 63 insertions(+), 22 deletions(-) create mode 100644 resources/views/notifications/component/update.blade.php create mode 100644 resources/views/notifications/incident/update.blade.php create mode 100644 resources/views/notifications/schedule/new.blade.php diff --git a/app/Notifications/Component/ComponentStatusChangedNotification.php b/app/Notifications/Component/ComponentStatusChangedNotification.php index 67c1f04aa015..8621e6f7902d 100644 --- a/app/Notifications/Component/ComponentStatusChangedNotification.php +++ b/app/Notifications/Component/ComponentStatusChangedNotification.php @@ -84,12 +84,15 @@ public function toMail($notifiable) ]); return (new MailMessage()) - ->subject(trans('notifications.component.status_update.mail.subject')) - ->greeting(trans('notifications.component.status_update.mail.subject')) - ->line($content) - ->action(trans('notifications.component.status_update.mail.action'), cachet_route('status-page')) - ->line(trans('cachet.subscriber.unsubscribe', ['link' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code)])) - ->line(trans('cachet.subscriber.manage.manage_at_link', ['link' => cachet_route('subscribe.manage', $notifiable->verify_code)])); + ->subject(trans('notifications.component.status_update.mail.subject')) + ->markdown('notifications.component.update', [ + 'componentName' => $this->component->name, + 'content' => $content, + 'unsubscribeText' => trans('cachet.subscriber.unsubscribe'), + 'unsubscribeUrl' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code), + 'manageSubscriptionText' => trans('cachet.subscriber.manage_subscription'), + 'manageSubscriptionUrl' => cachet_route('subscribe.manage', $notifiable->verify_code), + ]); } /** diff --git a/app/Notifications/IncidentUpdate/IncidentUpdatedNotification.php b/app/Notifications/IncidentUpdate/IncidentUpdatedNotification.php index d5bca3f2ae3d..4fe3f9208ff9 100644 --- a/app/Notifications/IncidentUpdate/IncidentUpdatedNotification.php +++ b/app/Notifications/IncidentUpdate/IncidentUpdatedNotification.php @@ -73,18 +73,20 @@ public function toMail($notifiable) 'name' => $this->update->incident->name, 'time' => $this->update->created_at_diff, ]); - return (new MailMessage()) - ->subject(trans('notifications.incident.update.mail.subject')) - ->greeting(trans('notifications.incident.update.mail.title', [ - 'name' => $this->update->incident->name, - 'new_status' => $this->update->human_status, - ])) - ->line($content) - ->action(trans('notifications.incident.update.mail.action'), cachet_route('incident', [$this->update->incident])) - ->line($this->update->raw_message) - ->line(trans('cachet.subscriber.unsubscribe', ['link' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code)])) - ->line(trans('cachet.subscriber.manage.manage_at_link', ['link' => cachet_route('subscribe.manage', $notifiable->verify_code)])); + ->subject(trans('notifications.incident.update.mail.subject')) + ->markdown('notifications.incident.update', [ + 'incident' => $this->update->incident, + 'content' => $content, + 'actionText' => trans('notifications.incident.new.mail.action'), + 'actionUrl' => cachet_route('incident', [$this->update->incident]), + 'incidentName' => $this->update->incident->name, + 'newStatus' => $this->update->human_status, + 'unsubscribeText' => trans('cachet.subscriber.unsubscribe'), + 'unsubscribeUrl' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code), + 'manageSubscriptionText' => trans('cachet.subscriber.manage_subscription'), + 'manageSubscriptionUrl' => cachet_route('subscribe.manage', $notifiable->verify_code), + ]); } /** diff --git a/app/Notifications/Schedule/NewScheduleNotification.php b/app/Notifications/Schedule/NewScheduleNotification.php index fa7bfd98adc0..dd93398aea23 100644 --- a/app/Notifications/Schedule/NewScheduleNotification.php +++ b/app/Notifications/Schedule/NewScheduleNotification.php @@ -74,11 +74,14 @@ public function toMail($notifiable) ]); return (new MailMessage()) - ->subject(trans('notifications.schedule.new.mail.subject')) - ->greeting(trans('notifications.schedule.new.mail.title')) - ->line($content) - ->action(trans('notifications.schedule.new.mail.action'), cachet_route('schedule', [$this->schedule])) - ->line(trans('cachet.subscriber.unsubscribe', ['link' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code)])); + ->subject(trans('notifications.schedule.new.mail.subject')) + ->markdown('notifications.schedule.new', [ + 'content' => $content, + 'unsubscribeText' => trans('cachet.subscriber.unsubscribe'), + 'unsubscribeUrl' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code), + 'manageSubscriptionText' => trans('cachet.subscriber.manage_subscription'), + 'manageSubscriptionUrl' => cachet_route('subscribe.manage', $notifiable->verify_code), + ]); } /** diff --git a/resources/views/notifications/component/update.blade.php b/resources/views/notifications/component/update.blade.php new file mode 100644 index 000000000000..5aea67bdaeb0 --- /dev/null +++ b/resources/views/notifications/component/update.blade.php @@ -0,0 +1,11 @@ +@component('mail::message') +# {{ trans('notifications.component.status_update.mail.greeting') }} + +{{ $content }} + +Thanks,
+{{ Config::get('setting.app_name') }} + +@include('notifications.partials.subscription') + +@endcomponent \ No newline at end of file diff --git a/resources/views/notifications/incident/update.blade.php b/resources/views/notifications/incident/update.blade.php new file mode 100644 index 000000000000..7817d4c8639c --- /dev/null +++ b/resources/views/notifications/incident/update.blade.php @@ -0,0 +1,11 @@ +@component('mail::message') +# {{ trans('notifications.incident.update.mail.title', ['name' => $incidentName, 'new_status' => $newStatus]) }} + +{{ $content }} + +Thanks,
+{{ Config::get('setting.app_name') }} + +@include('notifications.partials.subscription') + +@endcomponent \ No newline at end of file diff --git a/resources/views/notifications/schedule/new.blade.php b/resources/views/notifications/schedule/new.blade.php new file mode 100644 index 000000000000..d58d10a2ee80 --- /dev/null +++ b/resources/views/notifications/schedule/new.blade.php @@ -0,0 +1,11 @@ +@component('mail::message') +# {{ trans('notifications.schedule.new.mail.title') }} + +{{ $content }} + +Thanks,
+{{ Config::get('setting.app_name') }} + +@include('notifications.partials.subscription') + +@endcomponent \ No newline at end of file From 68b5457f9f15215ebbdc059adab275c7b68e9b7c Mon Sep 17 00:00:00 2001 From: James Wilson Date: Wed, 10 Oct 2018 14:04:22 +0100 Subject: [PATCH 2/3] Added a new line #3101 --- app/Notifications/IncidentUpdate/IncidentUpdatedNotification.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Notifications/IncidentUpdate/IncidentUpdatedNotification.php b/app/Notifications/IncidentUpdate/IncidentUpdatedNotification.php index 4fe3f9208ff9..13da6d995e8c 100644 --- a/app/Notifications/IncidentUpdate/IncidentUpdatedNotification.php +++ b/app/Notifications/IncidentUpdate/IncidentUpdatedNotification.php @@ -73,6 +73,7 @@ public function toMail($notifiable) 'name' => $this->update->incident->name, 'time' => $this->update->created_at_diff, ]); + return (new MailMessage()) ->subject(trans('notifications.incident.update.mail.subject')) ->markdown('notifications.incident.update', [ From 363c9fb0e800a18803bf7c80abe1d5dbe3951015 Mon Sep 17 00:00:00 2001 From: James Wilson Date: Wed, 10 Oct 2018 14:06:18 +0100 Subject: [PATCH 3/3] Another update! --- .../IncidentUpdate/IncidentUpdatedNotification.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Notifications/IncidentUpdate/IncidentUpdatedNotification.php b/app/Notifications/IncidentUpdate/IncidentUpdatedNotification.php index 13da6d995e8c..907ae366d059 100644 --- a/app/Notifications/IncidentUpdate/IncidentUpdatedNotification.php +++ b/app/Notifications/IncidentUpdate/IncidentUpdatedNotification.php @@ -73,7 +73,7 @@ public function toMail($notifiable) 'name' => $this->update->incident->name, 'time' => $this->update->created_at_diff, ]); - + return (new MailMessage()) ->subject(trans('notifications.incident.update.mail.subject')) ->markdown('notifications.incident.update', [