Don't send notifications when within maintenance window. Fixes #2720
This commit is contained in:
committed by
Nico Stapelbroek
parent
8485821491
commit
f53f88f950
@@ -12,12 +12,20 @@
|
||||
namespace CachetHQ\Cachet\Bus\Handlers\Events\Component;
|
||||
|
||||
use CachetHQ\Cachet\Bus\Events\Component\ComponentStatusWasChangedEvent;
|
||||
use CachetHQ\Cachet\Integrations\Contracts\System;
|
||||
use CachetHQ\Cachet\Models\Component;
|
||||
use CachetHQ\Cachet\Models\Subscriber;
|
||||
use CachetHQ\Cachet\Notifications\Component\ComponentStatusChangedNotification;
|
||||
|
||||
class SendComponentUpdateEmailNotificationHandler
|
||||
{
|
||||
/**
|
||||
* The system instance.
|
||||
*
|
||||
* @var \CachetHQ\Cachet\Integrations\Contracts\System
|
||||
*/
|
||||
protected $system;
|
||||
|
||||
/**
|
||||
* The subscriber instance.
|
||||
*
|
||||
@@ -32,8 +40,9 @@ class SendComponentUpdateEmailNotificationHandler
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Subscriber $subscriber)
|
||||
public function __construct(System $system, Subscriber $subscriber)
|
||||
{
|
||||
$this->system = $system;
|
||||
$this->subscriber = $subscriber;
|
||||
}
|
||||
|
||||
@@ -46,6 +55,11 @@ class SendComponentUpdateEmailNotificationHandler
|
||||
*/
|
||||
public function handle(ComponentStatusWasChangedEvent $event)
|
||||
{
|
||||
// Don't send component status updates if we're under maintenance.
|
||||
if ($this->system->underMaintenance()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$component = $event->component;
|
||||
|
||||
// If we're silent, then don't send this.
|
||||
|
||||
Reference in New Issue
Block a user