summaryrefslogtreecommitdiff
path: root/app/finders/issuable_finder.rb
diff options
context:
space:
mode:
authorKyle Bishop <kybishop@gmail.com>2017-06-13 14:02:35 -0700
committerKyle Bishop <kybishop@gmail.com>2017-06-18 15:43:51 -0700
commitef633d24786707672377312eea850ce2eb63f573 (patch)
treea6fe7a8f3707bda53b7ffc0b810fbe0ba52f8ee3 /app/finders/issuable_finder.rb
parent0037cf634dbcc8045fba9cbc28133cfde07dc97c (diff)
downloadgitlab-ce-ef633d24786707672377312eea850ce2eb63f573.tar.gz
add since and until params to issuables
Diffstat (limited to 'app/finders/issuable_finder.rb')
-rw-r--r--app/finders/issuable_finder.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb
index 957ad875858..558f8b5e2e5 100644
--- a/app/finders/issuable_finder.rb
+++ b/app/finders/issuable_finder.rb
@@ -41,6 +41,7 @@ class IssuableFinder
items = by_iids(items)
items = by_milestone(items)
items = by_label(items)
+ items = by_created_at(items)
# Filtering by project HAS TO be the last because we use the project IDs yielded by the issuable query thus far
items = by_project(items)
@@ -402,6 +403,18 @@ class IssuableFinder
params[:non_archived].present? ? items.non_archived : items
end
+ def by_created_at(items)
+ if params[:created_after].present?
+ items = items.where(items.klass.arel_table[:created_at].gteq(params[:created_after]))
+ end
+
+ if params[:created_before].present?
+ items = items.where(items.klass.arel_table[:created_at].lteq(params[:created_before]))
+ end
+
+ items
+ end
+
def current_user_related?
params[:scope] == 'created-by-me' || params[:scope] == 'authored' || params[:scope] == 'assigned-to-me'
end