Refactors out notify conditions. Closes #1083
This commit is contained in:
@@ -41,9 +41,7 @@ class ReportMaintenanceCommandHandler
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
// Notify subscribers.
|
// Notify subscribers.
|
||||||
if ($command->notify) {
|
event(new MaintenanceWasScheduledEvent($maintenanceEvent));
|
||||||
event(new MaintenanceWasScheduledEvent($maintenanceEvent));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $maintenanceEvent;
|
return $maintenanceEvent;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,9 +50,7 @@ class UpdateIncidentCommandHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Notify subscribers.
|
// Notify subscribers.
|
||||||
if ($command->notify) {
|
event(new IncidentWasUpdatedEvent($incident));
|
||||||
event(new IncidentWasUpdatedEvent($incident));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $incident;
|
return $incident;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,6 +56,10 @@ class SendIncidentEmailNotificationHandler
|
|||||||
*/
|
*/
|
||||||
public function handle(IncidentWasReportedEvent $event)
|
public function handle(IncidentWasReportedEvent $event)
|
||||||
{
|
{
|
||||||
|
if (!$event->incident->notify) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$incident = AutoPresenter::decorate($event->incident);
|
$incident = AutoPresenter::decorate($event->incident);
|
||||||
$component = AutoPresenter::decorate($event->incident->component);
|
$component = AutoPresenter::decorate($event->incident->component);
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,10 @@ class SendMaintenanceEmailNotificationHandler
|
|||||||
*/
|
*/
|
||||||
public function handle(MaintenanceWasScheduledEvent $event)
|
public function handle(MaintenanceWasScheduledEvent $event)
|
||||||
{
|
{
|
||||||
|
if (!$event->incident->notify) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$data = AutoPresenter::decorate($event->incident);
|
$data = AutoPresenter::decorate($event->incident);
|
||||||
|
|
||||||
foreach ($this->subscriber->all() as $subscriber) {
|
foreach ($this->subscriber->all() as $subscriber) {
|
||||||
|
|||||||
Reference in New Issue
Block a user