From 9ac6b8b1a26f30e3d3b3815b733cdbe4b80c55e0 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Sun, 17 Jun 2018 18:41:48 +0100 Subject: [PATCH 1/3] Fixes #2996 - New incident notification is Markdown powered --- .../Incident/NewIncidentNotification.php | 16 ++++++++++------ resources/lang/en/cachet.php | 9 +++++---- .../views/notifications/incident/new.blade.php | 17 +++++++++++++++++ 3 files changed, 32 insertions(+), 10 deletions(-) create mode 100644 resources/views/notifications/incident/new.blade.php diff --git a/app/Notifications/Incident/NewIncidentNotification.php b/app/Notifications/Incident/NewIncidentNotification.php index 15e4ab53..b6ec8ee6 100644 --- a/app/Notifications/Incident/NewIncidentNotification.php +++ b/app/Notifications/Incident/NewIncidentNotification.php @@ -75,12 +75,16 @@ class NewIncidentNotification extends Notification return (new MailMessage()) ->subject(trans('notifications.incident.new.mail.subject')) - ->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->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)])); + ->markdown('notifications.incident.new', [ + 'incident' => $this->incident, + 'content' => $content, + 'actionText' => trans('notifications.incident.new.mail.action'), + 'actionUrl' => cachet_route('incident', [$this->incident]), + '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/lang/en/cachet.php b/resources/lang/en/cachet.php index c1b48d01..ff1cd22b 100644 --- a/resources/lang/en/cachet.php +++ b/resources/lang/en/cachet.php @@ -75,10 +75,11 @@ return [ // Subscriber 'subscriber' => [ - 'subscribe' => 'Subscribe to get the updates', - 'unsubscribe' => 'Unsubscribe at :link', - 'button' => 'Subscribe', - 'manage' => [ + 'subscribe' => 'Subscribe to get the updates', + 'unsubscribe' => 'Unsubscribe', + 'button' => 'Subscribe', + 'manage_subscription' => 'Manage subscription', + 'manage' => [ 'no_subscriptions' => 'You\'re currently subscribed to all updates.', 'my_subscriptions' => 'You\'re currently subscribed to the following updates.', 'manage_at_link' => 'Manage your subscriptions at :link', diff --git a/resources/views/notifications/incident/new.blade.php b/resources/views/notifications/incident/new.blade.php new file mode 100644 index 00000000..c4c84775 --- /dev/null +++ b/resources/views/notifications/incident/new.blade.php @@ -0,0 +1,17 @@ +@component('mail::message') +# {{ trans('notifications.incident.new.mail.greeting', ['app_name' => Config::get('setting.app_name')]) }} + +{{ $incident->message }} + +@component('mail::button', ['url' => $actionUrl]) +{{ $actionText }} +@endcomponent + +Thanks,
+{{ config('app.name') }} + +@component('mail::subcopy') +[{{ $unsubscribeText }}]({{ $unsubscribeUrl }}) — [{{ $manageSubscriptionText }}]({{ $manageSubscriptionUrl }}) +@endcomponent + +@endcomponent From 05242a0c5a91e8e5c90709347f0498d6ee5f3e77 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Sun, 17 Jun 2018 17:41:59 +0000 Subject: [PATCH 2/3] Apply fixes from StyleCI [ci skip] [skip ci] --- .../Incident/NewIncidentNotification.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/Notifications/Incident/NewIncidentNotification.php b/app/Notifications/Incident/NewIncidentNotification.php index b6ec8ee6..8ad938bb 100644 --- a/app/Notifications/Incident/NewIncidentNotification.php +++ b/app/Notifications/Incident/NewIncidentNotification.php @@ -76,14 +76,14 @@ class NewIncidentNotification extends Notification return (new MailMessage()) ->subject(trans('notifications.incident.new.mail.subject')) ->markdown('notifications.incident.new', [ - 'incident' => $this->incident, - 'content' => $content, - 'actionText' => trans('notifications.incident.new.mail.action'), - 'actionUrl' => cachet_route('incident', [$this->incident]), - 'unsubscribeText' => trans('cachet.subscriber.unsubscribe'), - 'unsubscribeUrl' => cachet_route('subscribe.unsubscribe', $notifiable->verify_code), + 'incident' => $this->incident, + 'content' => $content, + 'actionText' => trans('notifications.incident.new.mail.action'), + 'actionUrl' => cachet_route('incident', [$this->incident]), + '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), + 'manageSubscriptionUrl' => cachet_route('subscribe.manage', $notifiable->verify_code), ]); } From b26ec1230c04efd430084bd14c1837954231bea5 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Mon, 18 Jun 2018 07:15:02 +0100 Subject: [PATCH 3/3] Fix app name and move subscription options into partial --- resources/views/notifications/incident/new.blade.php | 6 ++---- .../views/notifications/partials/subscription.blade.php | 3 +++ 2 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 resources/views/notifications/partials/subscription.blade.php diff --git a/resources/views/notifications/incident/new.blade.php b/resources/views/notifications/incident/new.blade.php index c4c84775..22f4ddcc 100644 --- a/resources/views/notifications/incident/new.blade.php +++ b/resources/views/notifications/incident/new.blade.php @@ -8,10 +8,8 @@ @endcomponent Thanks,
-{{ config('app.name') }} +{{ Config::get('setting.app_name') }} -@component('mail::subcopy') -[{{ $unsubscribeText }}]({{ $unsubscribeUrl }}) — [{{ $manageSubscriptionText }}]({{ $manageSubscriptionUrl }}) -@endcomponent +@include('notifications.partials.subscription') @endcomponent diff --git a/resources/views/notifications/partials/subscription.blade.php b/resources/views/notifications/partials/subscription.blade.php new file mode 100644 index 00000000..6e8ebf3d --- /dev/null +++ b/resources/views/notifications/partials/subscription.blade.php @@ -0,0 +1,3 @@ +@component('mail::subcopy') +[{{ $unsubscribeText }}]({{ $unsubscribeUrl }}) — [{{ $manageSubscriptionText }}]({{ $manageSubscriptionUrl }}) +@endcomponent