diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-11 18:09:37 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-11 18:09:37 +0300 |
commit | 6217d19741a8ea4351813b13c6fb39cc6a746602 (patch) | |
tree | 148b37b12e23835691de2a6dad4a425e678bc33d /app/finders | |
parent | e3190840bc2e05ed04a49869978a54b7b518edf1 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/alert_management/alerts_finder.rb | 7 |
1 files changed, 7 insertions, 0 deletions
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 |