Merge pull request #902 from cachethq/incident-email-component

Add the component name to incident emails, if applicable. Closes #794
This commit is contained in:
James Brooks
2015-08-15 09:03:49 +01:00
3 changed files with 13 additions and 4 deletions

View File

@@ -61,7 +61,8 @@ class SendIncidentEmailNotificationHandler
*/
public function handle(IncidentHasReportedEvent $event)
{
$data = $this->presenter->decorate($event->incident);
$incident = $this->presenter->decorate($event->incident);
$component = $this->presenter->decorate($event->incident->component);
// Only send emails for public incidents.
if ($event->incident->visible === 1) {
@@ -69,9 +70,11 @@ class SendIncidentEmailNotificationHandler
$mail = [
'email' => $subscriber->email,
'subject' => 'New incident reported.',
'status' => $data->humanStatus,
'htmlContent' => $data->formattedMessage,
'textContent' => $data->message,
'hasComponent' => ($event->incident->component) ? true : false,
'componentName' => $component->name,
'status' => $incident->humanStatus,
'htmlContent' => $incident->formattedMessage,
'textContent' => $incident->message,
'token' => $subscriber->token,
'unsubscribeLink' => route('subscribe.unsubscribe', ['code' => $subscriber->verify_code]),
'appUrl' => env('APP_URL'),

View File

@@ -9,6 +9,9 @@
<p>
{!! $status !!}
@if($hasComponent)
({{ $componentName }})
@endif
</p>
<p>

View File

@@ -1,6 +1,9 @@
{!! trans('cachet.subscriber.email.incident.text', ['app_name' => Setting::get('app_name')]) !!}
{!! $status !!}
@if($hasComponent)
({{ $componentName }})
@endif
{!! $textContent !!}