diff --git a/app/Bus/Handlers/Commands/Incident/ReportIncidentCommandHandler.php b/app/Bus/Handlers/Commands/Incident/ReportIncidentCommandHandler.php index 4c9515e3..360aa287 100644 --- a/app/Bus/Handlers/Commands/Incident/ReportIncidentCommandHandler.php +++ b/app/Bus/Handlers/Commands/Incident/ReportIncidentCommandHandler.php @@ -50,17 +50,18 @@ class ReportIncidentCommandHandler */ public function handle(ReportIncidentCommand $command) { - if ($command->template) { - $command->message = $this->parseIncidentTemplate($command->template, $command->template_vars); - } - $data = [ 'name' => $command->name, 'status' => $command->status, - 'message' => $command->message, 'visible' => $command->visible, ]; + if ($command->template) { + $data['message'] = $this->parseIncidentTemplate($command->template, $command->template_vars); + } else { + $data['message'] = $command->message; + } + // Link with the component. if ($command->component_id) { $data['component_id'] = $command->component_id; @@ -101,6 +102,10 @@ class ReportIncidentCommandHandler */ protected function parseIncidentTemplate($templateSlug, $vars) { + if ($vars === null) { + $vars = []; + } + Twig::setLoader(new Twig_Loader_String()); $template = IncidentTemplate::forSlug($templateSlug)->first(); diff --git a/config/twigbridge.php b/config/twigbridge.php index e2b57755..d4dcfd06 100644 --- a/config/twigbridge.php +++ b/config/twigbridge.php @@ -35,7 +35,7 @@ return [ // When set to true, the generated templates have a __toString() method // that you can use to display the generated nodes. // default: false - 'debug' => config('app.debug', false), + 'debug' => false, // The charset used by the templates. // default: utf-8