From 6217d19741a8ea4351813b13c6fb39cc6a746602 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 11 May 2020 15:09:37 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- app/finders/alert_management/alerts_finder.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'app/finders') diff --git a/app/finders/alert_management/alerts_finder.rb b/app/finders/alert_management/alerts_finder.rb index a48dadc7fdb..eeb6b5f8491 100644 --- a/app/finders/alert_management/alerts_finder.rb +++ b/app/finders/alert_management/alerts_finder.rb @@ -12,6 +12,7 @@ module AlertManagement return AlertManagement::Alert.none unless authorized? collection = project.alert_management_alerts + collection = by_status(collection) collection = by_iid(collection) sort(collection) end @@ -26,6 +27,12 @@ module AlertManagement collection.for_iid(params[:iid]) end + def by_status(collection) + values = AlertManagement::Alert::STATUSES.values & Array(params[:status]) + + values.present? ? collection.for_status(values) : collection + end + def sort(collection) params[:sort] ? collection.sort_by_attribute(params[:sort]) : collection end -- cgit v1.2.3