Determine if notifications are suppressed when handeling events
This commit is contained in:
@@ -55,15 +55,10 @@ 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.
|
||||
if ($event->silent) {
|
||||
// If we're silent or the notifications are suppressed don't send this.
|
||||
if ($event->silent || !$this->system->canNotifySubscribers()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,14 +55,9 @@ class SendIncidentEmailNotificationHandler
|
||||
*/
|
||||
public function handle(IncidentWasCreatedEvent $event)
|
||||
{
|
||||
// Don't send incident updates if we're under maintenance.
|
||||
if ($this->system->underMaintenance()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$incident = $event->incident;
|
||||
|
||||
if (!$event->notify) {
|
||||
if (!$event->notify || !$this->system->canNotifySubscribers()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+2
-7
@@ -55,16 +55,11 @@ class SendIncidentUpdateEmailNotificationHandler
|
||||
*/
|
||||
public function handle(IncidentUpdateWasReportedEvent $event)
|
||||
{
|
||||
// Don't send incident updates if we're under maintenance.
|
||||
if ($this->system->underMaintenance()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$update = $event->update;
|
||||
$incident = $update->incident;
|
||||
|
||||
// Only send emails for public incidents.
|
||||
if (!$incident->visible) {
|
||||
// Only send emails for public incidents while the system is not under scheduled maintenance.
|
||||
if (!$incident->visible || !$this->system->canNotifySubscribers()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user