Add manage link to email notifications

This commit is contained in:
Joseph Cohen
2016-02-20 12:23:06 -06:00
committed by Graham Campbell
parent af0e578a44
commit e51504b3ec
12 changed files with 56 additions and 35 deletions

View File

@@ -59,6 +59,7 @@ class SendComponentUpdateEmailNotificationHandler
foreach (Subscription::isVerifiedForComponent($component->id)->with('subscriber')->get() as $subscription) {
$subscriber = $subscription->subscriber;
$mail['email'] = $subscriber->email;
$mail['manage_link'] = route('subscribe.manage', ['code' => $subscriber->verify_code]);
$mail['unsubscribe_link'] = route('subscribe.unsubscribe', ['code' => $subscriber->verify_code, 'subscription' => $subscription->id]);
$this->mailer->queue([

View File

@@ -75,6 +75,7 @@ class SendIncidentEmailNotificationHandler
'html_content' => $incident->formattedMessage,
'text_content' => $incident->message,
'token' => $subscriber->token,
'manage_link' => route('subscribe.manage', ['code' => $subscriber->verify_code]),
'unsubscribe_link' => route('subscribe.unsubscribe', ['code' => $subscriber->verify_code]),
];

View File

@@ -71,6 +71,7 @@ class SendMaintenanceEmailNotificationHandler
'text_content' => $data->message,
'scheduled_at' => $data->scheduled_at_formatted,
'token' => $subscriber->token,
'manage_link' => route('subscribe.manage', ['code' => $subscriber->verify_code]),
'unsubscribe_link' => route('subscribe.unsubscribe', ['code' => $subscriber->verify_code]),
];

View File

@@ -131,11 +131,13 @@ class SubscribeController extends Controller
/**
* Shows the subscription manager page.
*
* @param string|null $code
*
* @return \Illuminate\View\View
*/
public function showManage()
public function showManage($code = null)
{
if (!($code = Binput::get('subscriber'))) {
if ($code === null) {
throw new NotFoundHttpException();
}

View File

@@ -39,8 +39,8 @@ class SubscribeRoutes
'uses' => 'SubscribeController@postSubscribe',
]);
$router->get('subscribe/manage', [
'as' => 'subscribe.manage',
$router->get('subscribe/manage/{code}', [
'as' => 'manage',
'uses' => 'SubscribeController@showManage',
]);

View File

@@ -71,6 +71,7 @@ return [
'subscribe' => 'Subscribe to email updates.',
'subscribed' => 'You\'ve been subscribed to email notifications, please check your email to confirm your subscription.',
'verified' => 'Your email subscription has been confirmed. Thank you!',
'manage' => 'Manage your subscription.',
'unsubscribe' => 'Unsubscribe from email updates.',
'unsubscribed' => 'Your email subscription has been cancelled.',
'failure' => 'Something went wrong with the subscription.',

View File

@@ -10,6 +10,9 @@
@if($show_support)
<p>{!! trans('cachet.powered_by', ['app' => $app_name]) !!}</p>
@endif
<p>
<small><a href="{{ $manage_link }}">{!! trans('cachet.subscriber.email.manage') !!}</a></small>
</p>
<p>
<small><a href="{{ $unsubscribe_link }}">{!! trans('cachet.subscriber.email.unsubscribe') !!}</a></small>
</p>

View File

@@ -4,4 +4,6 @@
{!! trans('cachet.powered_by', ['app' => $app_name]) !!}
@endif
{!! trans('cachet.subscriber.email.manage') !!} {{ $manage_link }}
{!! trans('cachet.subscriber.email.unsubscribe') !!} {{ $unsubscribe_link }}

View File

@@ -5,22 +5,25 @@
@stop
@section('content')
{!! trans('cachet.subscriber.email.maintenance.html', ['app_name' => $app_name]) !!}
{!! trans('cachet.subscriber.email.maintenance.html', ['app_name' => $app_name]) !!}
<p>{{ $scheduled_at }}</p>
<p>{{ $scheduled_at }}</p>
<p>
{!! $status !!}
</p>
<p>
{!! $status !!}
</p>
<p>
{!! $html_content !!}
</p>
<p>
{!! $html_content !!}
</p>
@if($show_support)
<p>{!! trans('cachet.powered_by', ['app' => $app_name]) !!}</p>
@endif
<p>
<small><a href="{{ $unsubscribe_link }}">{!! trans('cachet.subscriber.email.unsubscribe') !!}</a></small>
</p>
@if($show_support)
<p>{!! trans('cachet.powered_by', ['app' => $app_name]) !!}</p>
@endif
<p>
<small><a href="{{ $manage_link }}">{!! trans('cachet.subscriber.email.manage') !!}</a></small>
</p>
<p>
<small><a href="{{ $unsubscribe_link }}">{!! trans('cachet.subscriber.email.unsubscribe') !!}</a></small>
</p>
@stop

View File

@@ -10,4 +10,6 @@
{!! trans('cachet.powered_by', ['app' => $app_name]) !!}
@endif
{!! trans('cachet.subscriber.email.manage') !!} {{ $manage_link }}
{!! trans('cachet.subscriber.email.unsubscribe') !!} {{ $unsubscribe_link }}

View File

@@ -5,23 +5,26 @@
@stop
@section('content')
{!! trans('cachet.subscriber.email.incident.html-preheader', ['app_name' => $app_name]) !!}
{!! trans('cachet.subscriber.email.incident.html-preheader', ['app_name' => $app_name]) !!}
<p>
{!! $status !!}
@if($has_component)
({{ $component_name }})
@endif
</p>
<p>
{!! $html_content !!}
</p>
@if($show_support)
<p>{!! trans('cachet.powered_by', ['app' => $app_name]) !!}</p>
<p>
{!! $status !!}
@if($has_component)
({{ $component_name }})
@endif
<p>
<small><a href="{{ $unsubscribe_link }}">{!! trans('cachet.subscriber.email.unsubscribe') !!}</a></small>
</p>
</p>
<p>
{!! $html_content !!}
</p>
@if($show_support)
<p>{!! trans('cachet.powered_by', ['app' => $app_name]) !!}</p>
@endif
<p>
<small><a href="{{ $manage_link }}">{!! trans('cachet.subscriber.email.manage') !!}</a></small>
</p>
<p>
<small><a href="{{ $unsubscribe_link }}">{!! trans('cachet.subscriber.email.unsubscribe') !!}</a></small>
</p>
@stop

View File

@@ -11,4 +11,6 @@
{!! trans('cachet.powered_by', ['app' => $app_name]) !!}
@endif
{!! trans('cachet.subscriber.email.manage') !!} {{ $manage_link }}
{!! trans('cachet.subscriber.email.unsuscribe') !!} {{ $unsubscribe_link }}