diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-10-05 08:21:32 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-10-05 08:21:32 +0000 |
commit | 1e9003f4a42fa75b25045701fec5e9aa32cae71a (patch) | |
tree | b6d02f78aba4d5ceae29b8f3c5ae7321ebc5de19 /app/finders | |
parent | 3c8ccd2eda593205de8edde5102249372a1ed3a2 (diff) | |
parent | a1c3d40739ed133e1ca1cd9191628acf938809cf (diff) | |
download | gitlab-ce-1e9003f4a42fa75b25045701fec5e9aa32cae71a.tar.gz |
Merge branch '51748-filter-any-milestone-via-api' into 'master'
Allows to filter issues by `Any milestone` in the API
Closes #51748
See merge request gitlab-org/gitlab-ce!22080
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/issuable_finder.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb index 9e24154e4b6..17e9b59b355 100644 --- a/app/finders/issuable_finder.rb +++ b/app/finders/issuable_finder.rb @@ -428,6 +428,10 @@ class IssuableFinder params[:milestone_title] == Milestone::Upcoming.name end + def filter_by_any_milestone? + params[:milestone_title] == Milestone::Any.title + end + def filter_by_started_milestone? params[:milestone_title] == Milestone::Started.name end @@ -437,6 +441,8 @@ class IssuableFinder if milestones? if filter_by_no_milestone? items = items.left_joins_milestones.where(milestone_id: [-1, nil]) + elsif filter_by_any_milestone? + items = items.any_milestone elsif filter_by_upcoming_milestone? upcoming_ids = Milestone.upcoming_ids_by_projects(projects(items)) items = items.left_joins_milestones.where(milestone_id: upcoming_ids) |