Skip to content

Commit f344038

Browse files
committed
Improve email content and subject, fix component notification presenter
1 parent bad9b1d commit f344038

File tree

9 files changed

+69
-30
lines changed

9 files changed

+69
-30
lines changed

app/Bus/Handlers/Events/Component/SendComponentUpdateEmailNotificationHandler.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function __construct(MailQueue $mailer, Subscriber $subscriber)
5757
*/
5858
public function handle(ComponentWasUpdatedEvent $event)
5959
{
60-
$component = AutoPresenter::decorate($event->component);
60+
$component = $event->component;
6161

6262
// First notify all global subscribers.
6363
$globalSubscribers = $this->subscriber->isVerified()->isGlobal()->get();
@@ -92,6 +92,8 @@ public function handle(ComponentWasUpdatedEvent $event)
9292
*/
9393
public function notify(Component $component, Subscriber $subscriber)
9494
{
95+
$component = AutoPresenter::decorate($component);
96+
9597
$mail = [
9698
'subject' => trans('cachet.subscriber.email.component.subject'),
9799
'component_name' => $component->name,

app/Bus/Handlers/Events/Incident/SendIncidentEmailNotificationHandler.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,14 @@ public function notify(IncidentWasReportedEvent $event, $subscriber)
107107

108108
$mail = [
109109
'email' => $subscriber->email,
110-
'subject' => 'New incident reported.',
110+
'subject' => trans('cachet.subscriber.email.incident.subject', [
111+
'status' => $incident->human_status,
112+
'name' => $incident->name,
113+
]),
111114
'has_component' => ($event->incident->component) ? true : false,
112115
'component_name' => $component ? $component->name : null,
116+
'name' => $incident->name,
117+
'timestamp' => $incident->created_at_formatted,
113118
'status' => $incident->human_status,
114119
'html_content' => $incident->formattedMessage,
115120
'text_content' => $incident->message,

app/Bus/Handlers/Events/Incident/SendMaintenanceEmailNotificationHandler.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,13 @@ public function notify(MaintenanceWasScheduledEvent $event, $subscriber)
107107

108108
$mail = [
109109
'email' => $subscriber->email,
110-
'subject' => 'Scheduled maintenance.',
110+
'subject' => trans('cachet.subscriber.email.maintenance.subject', [
111+
'name' => $incident->name,
112+
]),
111113
'has_component' => ($event->incident->component) ? true : false,
112114
'component_name' => $component ? $component->name : null,
115+
'name' => $incident->name,
116+
'timestamp' => $incident->scheduled_at_formatted,
113117
'status' => $incident->human_status,
114118
'html_content' => $incident->formattedMessage,
115119
'text_content' => $incident->message,

resources/lang/en/cachet.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,10 @@
8686
'button' => 'Confirm Subscription',
8787
],
8888
'maintenance' => [
89-
'text' => "New maintenance has been scheduled on :app_name.\nThank you, :app_name",
90-
'html' => '<p>New maintenance has been scheduled on :app_name.</p>',
89+
'subject' => "[Maintenance Scheduled] :name",
9190
],
9291
'incident' => [
93-
'text' => "New incident has been reported on :app_name.\nThank you, :app_name",
94-
'html' => '<p>New incident has been reported on :app_name.</p><p>Thank you, :app_name</p>',
92+
'subject' => "[New Incident] :status: :name",
9593
],
9694
'component' => [
9795
'subject' => 'Component Status Update',

resources/views/emails/incidents/maintenance-html.blade.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
@extends('layout.emails')
22

33
@section('content')
4-
{!! trans('cachet.subscriber.email.maintenance.html', ['app_name' => $app_name]) !!}
4+
<h1 class="align-center">{!! $name !!}</h1>
55

6-
<p>{{ $scheduled_at }}</p>
7-
8-
<p>{!! $status !!}</p>
9-
10-
<p>{!! $html_content !!}</p>
6+
<table class="border-rounded" width="100%" cellpadding="0" cellspacing="0">
7+
<tr>
8+
<td>
9+
<p class="compressed">
10+
<strong>{!! $status !!} @if($has_component) ({{ $component_name }}) @endif</strong>
11+
{!! $html_content !!}
12+
{!! $timestamp !!}
13+
</p>
14+
</td>
15+
<tr>
16+
</table>
1117

1218
<table class="body-action" align="center" width="100%" cellpadding="0" cellspacing="0">
1319
<tr>
@@ -24,9 +30,9 @@
2430
</tr>
2531
</table>
2632

27-
<table class="body-sub">
33+
<table class="body-sub" align="center">
2834
<tr>
29-
<td>
35+
<td align="center">
3036
<p class="sub"><a href="{{ $unsubscribe_link }}">{!! trans('cachet.subscriber.email.unsubscribe') !!}</a></p>
3137
</td>
3238
</tr>

resources/views/emails/incidents/maintenance-text.blade.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
{!! trans('cachet.subscriber.email.maintenance.text', ['app_name' => $app_name]) !!}
2-
3-
{{ $scheduled_at }}
1+
{!! $name !!}
42

53
{!! $status !!}
6-
74
{!! $text_content !!}
5+
{!! $timestamp !!}
86

7+
@if($has_component)
8+
({{ $component_name }})
9+
@endif
910
{!! trans('cachet.subscriber.email.manage') !!} {{ $manage_link }}
1011

1112
{!! trans('cachet.subscriber.email.unsubscribe') !!} {{ $unsubscribe_link }}

resources/views/emails/incidents/new-html.blade.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
@extends('layout.emails')
22

33
@section('content')
4-
{!! trans('cachet.subscriber.email.incident.html-preheader', ['app_name' => $app_name]) !!}
4+
<h1 class="align-center">{!! $name !!}</h1>
55

6-
<p>{!! $status !!} @if($has_component)<strong> ({{ $component_name }})</strong>@endif</p>
7-
8-
<p>{!! $html_content !!}</p>
6+
<table class="border-rounded" width="100%" cellpadding="0" cellspacing="0">
7+
<tr>
8+
<td>
9+
<p class="compressed">
10+
<strong>{!! $status !!} @if($has_component) ({{ $component_name }}) @endif</strong>
11+
{!! $html_content !!}
12+
{!! $timestamp !!}
13+
</p>
14+
</td>
15+
<tr>
16+
</table>
917

1018
<table class="body-action" align="center" width="100%" cellpadding="0" cellspacing="0">
1119
<tr>
@@ -22,9 +30,9 @@
2230
</tr>
2331
</table>
2432

25-
<table class="body-sub">
33+
<table class="body-sub" align="center">
2634
<tr>
27-
<td>
35+
<td align="center">
2836
<p class="sub"><a href="{{ $unsubscribe_link }}">{!! trans('cachet.subscriber.email.unsubscribe') !!}</a></p>
2937
</td>
3038
</tr>

resources/views/emails/incidents/new-text.blade.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
{!! trans('cachet.subscriber.email.incident.text', ['app_name' => $app_name]) !!}
1+
{!! $name !!}
22

33
{!! $status !!}
4+
{!! $text_content !!}
5+
{!! $timestamp !!}
6+
47
@if($has_component)
58
({{ $component_name }})
69
@endif
710

8-
{!! $text_content !!}
9-
1011
{!! trans('cachet.subscriber.email.manage') !!} {{ $manage_link }}
1112

1213
{!! trans('cachet.subscriber.email.unsuscribe') !!} {{ $unsubscribe_link }}

resources/views/layout/emails.blade.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
border: 0;
5454
}
5555
.email-masthead_name {
56-
font-size: 16px;
56+
font-size: 40px;
5757
font-weight: bold;
5858
color: #bbbfc3;
5959
text-decoration: none;
@@ -83,6 +83,9 @@
8383
.email-footer p {
8484
color: #AEAEAE;
8585
}
86+
.email-footer img {
87+
width: 30px;
88+
}
8689
.body-action {
8790
width: 100%;
8891
margin: 30px auto;
@@ -97,15 +100,23 @@
97100
.content-cell {
98101
padding: 35px;
99102
}
103+
.align-center {
104+
text-align: center;
105+
}
100106
.align-right {
101107
text-align: right;
102108
}
109+
.border-rounded {
110+
border: 1px solid #EDEFF2;
111+
border-radius: 3px;
112+
padding: 12px;
113+
}
103114
104115
/* Type ------------------------------ */
105116
h1 {
106117
margin-top: 0;
107118
color: #2F3133;
108-
font-size: 19px;
119+
font-size: 36px;
109120
font-weight: bold;
110121
text-align: left;
111122
}
@@ -130,6 +141,9 @@
130141
line-height: 1.5em;
131142
text-align: left;
132143
}
144+
p.compressed {
145+
margin: 0;
146+
}
133147
p.sub {
134148
font-size: 12px;
135149
}

0 commit comments

Comments
 (0)