Add stickied incident

This commit is contained in:
Antoine GIRARD
2016-08-17 01:12:21 +02:00
parent 268e0c1747
commit 1954cf26f3
22 changed files with 191 additions and 14 deletions
@@ -62,6 +62,13 @@ final class ReportIncidentCommand
*/
public $notify;
/**
* Whether to stick the incident on top.
*
* @var bool
*/
public $stickied;
/**
* The date at which the incident occurred.
*
@@ -96,6 +103,7 @@ final class ReportIncidentCommand
'component_id' => 'int|required_with:component_status',
'component_status' => 'int|min:1|max:4|required_with:component_id',
'notify' => 'bool',
'stickied' => 'bool',
'incident_date' => 'string',
'template' => 'string',
];
@@ -110,13 +118,14 @@ final class ReportIncidentCommand
* @param int $component_id
* @param int $component_status
* @param bool $notify
* @param bool $stickied
* @param string|null $incident_date
* @param string|null $template
* @param array|null $template_vars
*
* @return void
*/
public function __construct($name, $status, $message, $visible, $component_id, $component_status, $notify, $incident_date, $template, array $template_vars = null)
public function __construct($name, $status, $message, $visible, $component_id, $component_status, $notify, $stickied, $incident_date, $template, array $template_vars = null)
{
$this->name = $name;
$this->status = $status;
@@ -125,6 +134,7 @@ final class ReportIncidentCommand
$this->component_id = $component_id;
$this->component_status = $component_status;
$this->notify = $notify;
$this->stickied = $stickied;
$this->incident_date = $incident_date;
$this->template = $template;
$this->template_vars = $template_vars;
@@ -71,6 +71,13 @@ final class UpdateIncidentCommand
*/
public $notify;
/**
* Whether to stick the incident on top.
*
* @var bool
*/
public $stickied;
/**
* The date that the incident occurred on.
*
@@ -105,6 +112,7 @@ final class UpdateIncidentCommand
'component_id' => 'int',
'component_status' => 'int|min:1|max:4|required_with:component_id',
'notify' => 'bool',
'stickied' => 'bool',
'template' => 'string',
];
@@ -119,13 +127,14 @@ final class UpdateIncidentCommand
* @param int $component_id
* @param int $component_status
* @param bool $notify
* @param bool $stickied
* @param string|null $incident_date
* @param string|null $template
* @param array|null $template_vars
*
* @return void
*/
public function __construct(Incident $incident, $name, $status, $message, $visible, $component_id, $component_status, $notify, $incident_date, $template, array $template_vars = null)
public function __construct(Incident $incident, $name, $status, $message, $visible, $component_id, $component_status, $notify, $stickied, $incident_date, $template, array $template_vars = null)
{
$this->incident = $incident;
$this->name = $name;
@@ -135,6 +144,7 @@ final class UpdateIncidentCommand
$this->component_id = $component_id;
$this->component_status = $component_status;
$this->notify = $notify;
$this->stickied = $stickied;
$this->incident_date = $incident_date;
$this->template = $template;
$this->template_vars = $template_vars;
@@ -65,9 +65,10 @@ class ReportIncidentCommandHandler
public function handle(ReportIncidentCommand $command)
{
$data = [
'name' => $command->name,
'status' => $command->status,
'visible' => $command->visible,
'name' => $command->name,
'status' => $command->status,
'visible' => $command->visible,
'stickied' => $command->stickied,
];
if ($command->template) {
@@ -54,6 +54,7 @@ class ReportMaintenanceCommandHandler
'scheduled_at' => $scheduledAt,
'status' => 0,
'visible' => 1,
'stickied' => false,
]);
$maintenanceEvent->notify = (bool) $command->notify;
@@ -107,6 +107,7 @@ class UpdateIncidentCommandHandler
'status' => $command->status,
'message' => $command->message,
'visible' => $command->visible,
'stickied' => $command->stickied,
'component_id' => $command->component_id,
'component_status' => $command->component_status,
'notify' => $command->notify,