diff --git a/app/Composers/StatusPageComposer.php b/app/Composers/StatusPageComposer.php index cfaa41b026c2..ddfed69b4f81 100644 --- a/app/Composers/StatusPageComposer.php +++ b/app/Composers/StatusPageComposer.php @@ -46,7 +46,9 @@ public function compose(View $view) ]; } elseif (Component::enabled()->notStatus(1)->count() === 0) { // If all our components are ok, do we have any non-fixed incidents? - $incidents = Incident::notScheduled()->orderBy('created_at', 'desc')->get(); + $incidents = Incident::notScheduled()->orderBy('created_at', 'desc')->get()->filter(function ($incident) { + return $incident->status > 0; + }); $incidentCount = $incidents->count(); if ($incidentCount === 0 || ($incidentCount >= 1 && (int) $incidents->first()->status === 4)) { diff --git a/app/Models/Incident.php b/app/Models/Incident.php index 8588619b201f..9ea702b575e9 100644 --- a/app/Models/Incident.php +++ b/app/Models/Incident.php @@ -16,6 +16,7 @@ use CachetHQ\Cachet\Models\Traits\SortableTrait; use CachetHQ\Cachet\Presenters\IncidentPresenter; use Carbon\Carbon; +use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; use McCool\LaravelAutoPresenter\HasPresenter; @@ -97,7 +98,7 @@ class Incident extends Model implements HasPresenter * * @return \Illuminate\Database\Eloquent\Builder */ - public function scopeVisible($query) + public function scopeVisible(Builder $query) { return $query->where('visible', 1); } @@ -109,9 +110,9 @@ public function scopeVisible($query) * * @return \Illuminate\Database\Eloquent\Builder */ - public function scopeScheduled($query) + public function scopeScheduled(Builder $query) { - return $query->where('status', 0)->where('scheduled_at', '>=', Carbon::now()); + return $query->where('status', 0)->where('scheduled_at', '>=', Carbon::now()->toDateTimeString()); } /** @@ -121,10 +122,12 @@ public function scopeScheduled($query) * * @return \Illuminate\Database\Eloquent\Builder */ - public function scopeNotScheduled($query) + public function scopeNotScheduled(Builder $query) { - return $query->where(function ($query) { - return $query->whereNull('scheduled_at')->orWhere('scheduled_at', '<=', Carbon::now()); + return $query->where('status', '>', 0)->orWhere(function ($query) { + $query->where('status', 0)->where(function ($query) { + $query->whereNull('scheduled_at')->orWhere('scheduled_at', '<=', Carbon::now()->toDateTimeString()); + }); }); } diff --git a/package.json b/package.json index 90906a41eb37..8301ed607d9a 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "cachet", "devDependencies": { "gulp": "~3.9.1", - "laravel-elixir": "~5.0.0", + "laravel-elixir": "~6.0.0-9", "animate-sass": "git+https://github.com/tgdev/animate-sass.git", "autosize": "^3.0.15", "bootstrap-sass": "^3.3.6",