Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-05 15:09:15 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-05 15:09:15 +0300
commit20d564f1064622ef0623434372ac3ceb03173331 (patch)
tree000d95440566cd189ea774168c9756bcc8fc5fae /app/finders
parent26384c9a61da9922b8fa4b8351d4e42d51661b37 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/concerns/time_frame_filter.rb14
-rw-r--r--app/finders/milestones_finder.rb2
2 files changed, 16 insertions, 0 deletions
diff --git a/app/finders/concerns/time_frame_filter.rb b/app/finders/concerns/time_frame_filter.rb
new file mode 100644
index 00000000000..e0baba25b64
--- /dev/null
+++ b/app/finders/concerns/time_frame_filter.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+module TimeFrameFilter
+ def by_timeframe(items)
+ return items unless params[:start_date] && params[:start_date]
+
+ start_date = params[:start_date].to_date
+ end_date = params[:end_date].to_date
+
+ items.within_timeframe(start_date, end_date)
+ rescue ArgumentError
+ items
+ end
+end
diff --git a/app/finders/milestones_finder.rb b/app/finders/milestones_finder.rb
index 77b55cbb838..cfe648d9f79 100644
--- a/app/finders/milestones_finder.rb
+++ b/app/finders/milestones_finder.rb
@@ -11,6 +11,7 @@
class MilestonesFinder
include FinderMethods
+ include TimeFrameFilter
attr_reader :params
@@ -24,6 +25,7 @@ class MilestonesFinder
items = by_title(items)
items = by_search_title(items)
items = by_state(items)
+ items = by_timeframe(items)
order(items)
end