diff --git a/app/Http/Controllers/Dashboard/IncidentController.php b/app/Http/Controllers/Dashboard/IncidentController.php index 94494386..3822a812 100644 --- a/app/Http/Controllers/Dashboard/IncidentController.php +++ b/app/Http/Controllers/Dashboard/IncidentController.php @@ -17,6 +17,7 @@ use CachetHQ\Cachet\Bus\Commands\Incident\RemoveIncidentCommand; use CachetHQ\Cachet\Bus\Commands\Incident\UpdateIncidentCommand; use CachetHQ\Cachet\Bus\Commands\IncidentUpdate\CreateIncidentUpdateCommand; use CachetHQ\Cachet\Bus\Commands\IncidentUpdate\UpdateIncidentUpdateCommand; +use CachetHQ\Cachet\Integrations\Contracts\System; use CachetHQ\Cachet\Models\Component; use CachetHQ\Cachet\Models\ComponentGroup; use CachetHQ\Cachet\Models\Incident; @@ -48,6 +49,13 @@ class IncidentController extends Controller */ protected $auth; + /** + * The system instance. + * + * @var \CachetHQ\Cachet\Integrations\Contracts\System + */ + protected $system; + /** * Creates a new incident controller instance. * @@ -55,9 +63,10 @@ class IncidentController extends Controller * * @return void */ - public function __construct(Guard $auth) + public function __construct(Guard $auth, System $system) { $this->auth = $auth; + $this->system = $system; View::share('sub_title', trans('dashboard.incidents.title')); } @@ -87,6 +96,7 @@ class IncidentController extends Controller ->withPageTitle(trans('dashboard.incidents.add.title').' - '.trans('dashboard.dashboard')) ->withComponentsInGroups(ComponentGroup::with('components')->get()) ->withComponentsOutGroups(Component::where('group_id', '=', 0)->get()) + ->withNotificationsEnabled($this->system->canNotifySubscribers()) ->withIncidentTemplates(IncidentTemplate::all()); } @@ -225,7 +235,8 @@ class IncidentController extends Controller ->withPageTitle(trans('dashboard.incidents.edit.title').' - '.trans('dashboard.dashboard')) ->withIncident($incident) ->withComponentsInGroups(ComponentGroup::with('components')->get()) - ->withComponentsOutGroups(Component::where('group_id', '=', 0)->get()); + ->withComponentsOutGroups(Component::where('group_id', '=', 0)->get()) + ->withNotificationsEnabled($this->system->canNotifySubscribers()); } /** @@ -309,7 +320,9 @@ class IncidentController extends Controller */ public function showCreateIncidentUpdateAction(Incident $incident) { - return View::make('dashboard.incidents.updates.add')->withIncident($incident); + return View::make('dashboard.incidents.updates.add') + ->withIncident($incident) + ->withNotificationsEnabled($this->system->canNotifySubscribers()); } /** @@ -351,7 +364,8 @@ class IncidentController extends Controller { return View::make('dashboard.incidents.updates.edit') ->withIncident($incident) - ->withUpdate($incidentUpdate); + ->withUpdate($incidentUpdate) + ->withNotificationsEnabled($this->system->canNotifySubscribers()); } /** diff --git a/resources/lang/en/forms.php b/resources/lang/en/forms.php index b43fe0a8..8921c725 100644 --- a/resources/lang/en/forms.php +++ b/resources/lang/en/forms.php @@ -53,6 +53,7 @@ return [ 'message-help' => 'You may also use Markdown.', 'occurred_at' => 'When did this incident occur?', 'notify_subscribers' => 'Notify subscribers?', + 'notify_disabled' => 'Due to scheduled maintenance, notifications about this incident or its components will be suppressed.', 'visibility' => 'Incident Visibility', 'stick_status' => 'Stick Incident', 'stickied' => 'Stickied', diff --git a/resources/views/dashboard/incidents/add.blade.php b/resources/views/dashboard/incidents/add.blade.php index 03735c33..c1140a67 100644 --- a/resources/views/dashboard/incidents/add.blade.php +++ b/resources/views/dashboard/incidents/add.blade.php @@ -13,6 +13,11 @@