Skip to content

Commit 6a6c8d8

Browse files
Merge pull request #1843 from CachetHQ/improve-emails
Improve email designs, use theme colours
2 parents 11d82a2 + 48ccc02 commit 6a6c8d8

18 files changed

+514
-186
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,

app/Foundation/Providers/ComposerServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function boot(Factory $factory)
3434
$factory->composer('*', CurrentUserComposer::class);
3535
$factory->composer(['index'], MetricsComposer::class);
3636
$factory->composer(['index', 'single-incident', 'subscribe', 'signup'], StatusPageComposer::class);
37-
$factory->composer(['index', 'single-incident', 'subscribe.*', 'signup', 'dashboard.settings.theme'], ThemeComposer::class);
37+
$factory->composer(['index', 'single-incident', 'subscribe.*', 'signup', 'dashboard.settings.theme', 'emails.*'], ThemeComposer::class);
3838
$factory->composer('dashboard.*', DashboardComposer::class);
3939
$factory->composer(['setup', 'dashboard.settings.localization'], TimezoneLocaleComposer::class);
4040
}

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"backup-manager/laravel": "^1.1",
3030
"barryvdh/laravel-cors": "^0.8",
3131
"doctrine/dbal": "^2.5",
32+
"fedeisas/laravel-mail-css-inliner": "^1.5",
3233
"fideloper/proxy": "^3.1",
3334
"graham-campbell/binput": "^3.4",
3435
"graham-campbell/core": "^5.1",

composer.lock

Lines changed: 154 additions & 55 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/app.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@
164164
'AltThree\Emoji\EmojiServiceProvider',
165165
'BackupManager\Laravel\Laravel5ServiceProvider',
166166
'Barryvdh\Cors\ServiceProvider',
167+
'Fedeisas\LaravelMailCssInliner\LaravelMailCssInlinerServiceProvider',
167168
'Fideloper\Proxy\TrustedProxyServiceProvider',
168169
'GrahamCampbell\Binput\BinputServiceProvider',
169170
'GrahamCampbell\Exceptions\ExceptionsServiceProvider',
3.72 KB
Loading

resources/lang/en/cachet.php

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -75,32 +75,27 @@
7575
'subscribe' => 'Subscribe to email updates.',
7676
'subscribed' => 'You\'ve been subscribed to email notifications, please check your email to confirm your subscription.',
7777
'verified' => 'Your email subscription has been confirmed. Thank you!',
78-
'manage' => 'Manage your subscription.',
78+
'manage' => 'Manage your subscription',
7979
'unsubscribe' => 'Unsubscribe from email updates.',
8080
'unsubscribed' => 'Your email subscription has been cancelled.',
8181
'failure' => 'Something went wrong with the subscription.',
8282
'already-subscribed' => 'Cannot subscribe :email because they\'re already subscribed.',
8383
'verify' => [
84-
'text' => "Please confirm your email subscription to :app_name status updates.\n:link\nThank you, :app_name",
85-
'html-preheader' => 'Please confirm your email subscription to :app_name status updates.',
86-
'html' => '<p>Please confirm your email subscription to :app_name status updates.</p><p><a href=":link">:link</a></p><p>Thank you, :app_name</p>',
84+
'text' => "Please confirm your email subscription to :app_name status updates.\n:link",
85+
'html' => '<p>Please confirm your email subscription to :app_name status updates.</p>',
86+
'button' => 'Confirm Subscription',
8787
],
8888
'maintenance' => [
89-
'text' => "New maintenance has been scheduled on :app_name.\nThank you, :app_name",
90-
'html-preheader' => 'New maintenance has been scheduled on :app_name.',
91-
'html' => '<p>New maintenance has been scheduled on :app_name.</p>',
89+
'subject' => '[Maintenance Scheduled] :name',
9290
],
9391
'incident' => [
94-
'text' => "New incident has been reported on :app_name.\nThank you, :app_name",
95-
'html-preheader' => 'New incident has been reported on :app_name.',
96-
'html' => '<p>New incident has been reported on :app_name.</p><p>Thank you, :app_name</p>',
92+
'subject' => '[New Incident] :status: :name',
9793
],
9894
'component' => [
99-
'subject' => 'Component Status Update',
100-
'text' => 'The component :component_name has seen a status change. The component is now at :component_human_status.\nThank you, :app_name',
101-
'html-preheader' => 'Component Update from :app_name',
102-
'html' => '<p>The component :component_name has seen a status change. The component is now at :component_human_status.</p><p>Thank you, :app_name</p>',
103-
'tooltip-title' => 'Subscribe to notifications for :component_name.',
95+
'subject' => 'Component Status Update',
96+
'text' => 'The component :component_name has seen a status change. The component is now at :component_human_status.\nThank you, :app_name',
97+
'html' => '<p>The component :component_name has seen a status change. The component is now at :component_human_status.</p><p>Thank you, :app_name</p>',
98+
'tooltip-title' => 'Subscribe to notifications for :component_name.',
10499
],
105100
],
106101
],
@@ -109,7 +104,6 @@
109104
'email' => [
110105
'invite' => [
111106
'text' => "You have been invited to the team :app_name status page, to sign up follow the next link.\n:link\nThank you, :app_name",
112-
'html-preheader' => 'You have been invited to the team :app_name.',
113107
'html' => '<p>You have been invited to the team :app_name status page, to sign up follow the next link.</p><p><a href=":link">:link</a></p><p>Thank you, :app_name</p>',
114108
],
115109
],
Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
@extends('layout.emails')
22

3-
@section('preheader')
4-
{!! trans('cachet.subscriber.email.component.html-preheader', ['app_name' => $app_name]) !!}
5-
@stop
6-
73
@section('content')
84
{!! trans('cachet.subscriber.email.component.html', ['component_name' => $component_name, 'component_human_status' => $component_human_status, 'app_name' => $app_name]) !!}
95

10-
@if($show_support)
11-
<p>{!! trans('cachet.powered_by', ['app' => $app_name]) !!}</p>
12-
@endif
13-
<p>
14-
<small><a href="{{ $manage_link }}">{!! trans('cachet.subscriber.email.manage') !!}</a></small>
15-
</p>
6+
<table class="body-action" align="center" width="100%" cellpadding="0" cellspacing="0">
7+
<tr>
8+
<td align="center">
9+
<div>
10+
<!--[if mso]><v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="{{ $manage_link }}" style="height:45px;v-text-anchor:middle;width:200px;" arcsize="7%" stroke="f" fill="t">
11+
<v:fill type="tile" color="#22BC66" />
12+
<w:anchorlock/>
13+
<center style="color:#ffffff;font-family:sans-serif;font-size:15px;">{!! trans('cachet.subscriber.email.manage') !!}</center>
14+
</v:roundrect><![endif]-->
15+
<a href="{{ $manage_link }}" class="button button--green">{!! trans('cachet.subscriber.email.manage') !!}</a>
16+
</div>
17+
</td>
18+
</tr>
19+
</table>
1620
@stop

0 commit comments

Comments
 (0)