Determine if notifications are suppressed when handeling events

This commit is contained in:
Nico Stapelbroek
2018-01-21 13:05:46 +01:00
parent f53f88f950
commit e358332048
5 changed files with 15 additions and 25 deletions

View File

@@ -104,13 +104,18 @@ class System implements SystemContract
}
/**
* Determine if Cachet has any open maintenance windows.
* Determine if Cachet is allowed to send notifications to users, subscribers or third party tools.
*
* @return bool
*/
public function underMaintenance()
public function canNotifySubscribers()
{
return Schedule::inProgress()->count() > 0;
$maintenancePeriods = Schedule::inProgress()->count();
if ($maintenancePeriods === 0) {
return true;
}
return !$this->config->get('suppress_notifications_in_maintenance');
}
/**