Improve email content and subject, fix component notification presenter

This commit is contained in:
Joseph Cohen
2016-05-28 12:25:36 -05:00
parent bad9b1d550
commit f3440389be
9 changed files with 69 additions and 30 deletions

View File

@@ -57,7 +57,7 @@ class SendComponentUpdateEmailNotificationHandler
*/
public function handle(ComponentWasUpdatedEvent $event)
{
$component = AutoPresenter::decorate($event->component);
$component = $event->component;
// First notify all global subscribers.
$globalSubscribers = $this->subscriber->isVerified()->isGlobal()->get();
@@ -92,6 +92,8 @@ class SendComponentUpdateEmailNotificationHandler
*/
public function notify(Component $component, Subscriber $subscriber)
{
$component = AutoPresenter::decorate($component);
$mail = [
'subject' => trans('cachet.subscriber.email.component.subject'),
'component_name' => $component->name,

View File

@@ -107,9 +107,14 @@ class SendIncidentEmailNotificationHandler
$mail = [
'email' => $subscriber->email,
'subject' => 'New incident reported.',
'subject' => trans('cachet.subscriber.email.incident.subject', [
'status' => $incident->human_status,
'name' => $incident->name,
]),
'has_component' => ($event->incident->component) ? true : false,
'component_name' => $component ? $component->name : null,
'name' => $incident->name,
'timestamp' => $incident->created_at_formatted,
'status' => $incident->human_status,
'html_content' => $incident->formattedMessage,
'text_content' => $incident->message,

View File

@@ -107,9 +107,13 @@ class SendMaintenanceEmailNotificationHandler
$mail = [
'email' => $subscriber->email,
'subject' => 'Scheduled maintenance.',
'subject' => trans('cachet.subscriber.email.maintenance.subject', [
'name' => $incident->name,
]),
'has_component' => ($event->incident->component) ? true : false,
'component_name' => $component ? $component->name : null,
'name' => $incident->name,
'timestamp' => $incident->scheduled_at_formatted,
'status' => $incident->human_status,
'html_content' => $incident->formattedMessage,
'text_content' => $incident->message,

View File

@@ -86,12 +86,10 @@ return [
'button' => 'Confirm Subscription',
],
'maintenance' => [
'text' => "New maintenance has been scheduled on :app_name.\nThank you, :app_name",
'html' => '<p>New maintenance has been scheduled on :app_name.</p>',
'subject' => "[Maintenance Scheduled] :name",
],
'incident' => [
'text' => "New incident has been reported on :app_name.\nThank you, :app_name",
'html' => '<p>New incident has been reported on :app_name.</p><p>Thank you, :app_name</p>',
'subject' => "[New Incident] :status: :name",
],
'component' => [
'subject' => 'Component Status Update',

View File

@@ -1,13 +1,19 @@
@extends('layout.emails')
@section('content')
{!! trans('cachet.subscriber.email.maintenance.html', ['app_name' => $app_name]) !!}
<h1 class="align-center">{!! $name !!}</h1>
<p>{{ $scheduled_at }}</p>
<p>{!! $status !!}</p>
<p>{!! $html_content !!}</p>
<table class="border-rounded" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td>
<p class="compressed">
<strong>{!! $status !!} @if($has_component) ({{ $component_name }}) @endif</strong>
{!! $html_content !!}
{!! $timestamp !!}
</p>
</td>
<tr>
</table>
<table class="body-action" align="center" width="100%" cellpadding="0" cellspacing="0">
<tr>
@@ -24,9 +30,9 @@
</tr>
</table>
<table class="body-sub">
<table class="body-sub" align="center">
<tr>
<td>
<td align="center">
<p class="sub"><a href="{{ $unsubscribe_link }}">{!! trans('cachet.subscriber.email.unsubscribe') !!}</a></p>
</td>
</tr>

View File

@@ -1,11 +1,12 @@
{!! trans('cachet.subscriber.email.maintenance.text', ['app_name' => $app_name]) !!}
{{ $scheduled_at }}
{!! $name !!}
{!! $status !!}
{!! $text_content !!}
{!! $timestamp !!}
@if($has_component)
({{ $component_name }})
@endif
{!! trans('cachet.subscriber.email.manage') !!} {{ $manage_link }}
{!! trans('cachet.subscriber.email.unsubscribe') !!} {{ $unsubscribe_link }}

View File

@@ -1,11 +1,19 @@
@extends('layout.emails')
@section('content')
{!! trans('cachet.subscriber.email.incident.html-preheader', ['app_name' => $app_name]) !!}
<h1 class="align-center">{!! $name !!}</h1>
<p>{!! $status !!} @if($has_component)<strong> ({{ $component_name }})</strong>@endif</p>
<p>{!! $html_content !!}</p>
<table class="border-rounded" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td>
<p class="compressed">
<strong>{!! $status !!} @if($has_component) ({{ $component_name }}) @endif</strong>
{!! $html_content !!}
{!! $timestamp !!}
</p>
</td>
<tr>
</table>
<table class="body-action" align="center" width="100%" cellpadding="0" cellspacing="0">
<tr>
@@ -22,9 +30,9 @@
</tr>
</table>
<table class="body-sub">
<table class="body-sub" align="center">
<tr>
<td>
<td align="center">
<p class="sub"><a href="{{ $unsubscribe_link }}">{!! trans('cachet.subscriber.email.unsubscribe') !!}</a></p>
</td>
</tr>

View File

@@ -1,12 +1,13 @@
{!! trans('cachet.subscriber.email.incident.text', ['app_name' => $app_name]) !!}
{!! $name !!}
{!! $status !!}
{!! $text_content !!}
{!! $timestamp !!}
@if($has_component)
({{ $component_name }})
@endif
{!! $text_content !!}
{!! trans('cachet.subscriber.email.manage') !!} {{ $manage_link }}
{!! trans('cachet.subscriber.email.unsuscribe') !!} {{ $unsubscribe_link }}

View File

@@ -53,7 +53,7 @@
border: 0;
}
.email-masthead_name {
font-size: 16px;
font-size: 40px;
font-weight: bold;
color: #bbbfc3;
text-decoration: none;
@@ -83,6 +83,9 @@
.email-footer p {
color: #AEAEAE;
}
.email-footer img {
width: 30px;
}
.body-action {
width: 100%;
margin: 30px auto;
@@ -97,15 +100,23 @@
.content-cell {
padding: 35px;
}
.align-center {
text-align: center;
}
.align-right {
text-align: right;
}
.border-rounded {
border: 1px solid #EDEFF2;
border-radius: 3px;
padding: 12px;
}
/* Type ------------------------------ */
h1 {
margin-top: 0;
color: #2F3133;
font-size: 19px;
font-size: 36px;
font-weight: bold;
text-align: left;
}
@@ -130,6 +141,9 @@
line-height: 1.5em;
text-align: left;
}
p.compressed {
margin: 0;
}
p.sub {
font-size: 12px;
}