Fixes #1437, fixes #

This commit is contained in:
James Brooks
2016-02-02 22:04:19 +00:00
parent 02816f99c0
commit 69e1bc3948
2 changed files with 11 additions and 6 deletions

View File

@@ -50,17 +50,18 @@ class ReportIncidentCommandHandler
*/ */
public function handle(ReportIncidentCommand $command) public function handle(ReportIncidentCommand $command)
{ {
if ($command->template) {
$command->message = $this->parseIncidentTemplate($command->template, $command->template_vars);
}
$data = [ $data = [
'name' => $command->name, 'name' => $command->name,
'status' => $command->status, 'status' => $command->status,
'message' => $command->message,
'visible' => $command->visible, 'visible' => $command->visible,
]; ];
if ($command->template) {
$data['message'] = $this->parseIncidentTemplate($command->template, $command->template_vars);
} else {
$data['message'] = $command->message;
}
// Link with the component. // Link with the component.
if ($command->component_id) { if ($command->component_id) {
$data['component_id'] = $command->component_id; $data['component_id'] = $command->component_id;
@@ -101,6 +102,10 @@ class ReportIncidentCommandHandler
*/ */
protected function parseIncidentTemplate($templateSlug, $vars) protected function parseIncidentTemplate($templateSlug, $vars)
{ {
if ($vars === null) {
$vars = [];
}
Twig::setLoader(new Twig_Loader_String()); Twig::setLoader(new Twig_Loader_String());
$template = IncidentTemplate::forSlug($templateSlug)->first(); $template = IncidentTemplate::forSlug($templateSlug)->first();

View File

@@ -35,7 +35,7 @@ return [
// When set to true, the generated templates have a __toString() method // When set to true, the generated templates have a __toString() method
// that you can use to display the generated nodes. // that you can use to display the generated nodes.
// default: false // default: false
'debug' => config('app.debug', false), 'debug' => false,
// The charset used by the templates. // The charset used by the templates.
// default: utf-8 // default: utf-8