diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-07-07 23:52:17 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-07-07 23:52:17 +0300 |
commit | 94e2a286846ee8b8b36ac29ccae7d51cb19578d5 (patch) | |
tree | 6c85174841a33bf75e4be48cbe8814b4c3e36b27 /app/finders/issuable_finder.rb | |
parent | ac09bbdc18eed278cf7f1b6d24acc27a879ab00f (diff) | |
parent | 6d28ad844d154eb8f7b9b7b8683b42ce70101789 (diff) |
Merge branch 'feature/user-datetime-search-api-mysql' into 'master'
Add creation time filters to user search API for admins
Closes #29507
See merge request !12682
Diffstat (limited to 'app/finders/issuable_finder.rb')
-rw-r--r-- | app/finders/issuable_finder.rb | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb index d81e9ed17d4..2e5a6493134 100644 --- a/app/finders/issuable_finder.rb +++ b/app/finders/issuable_finder.rb @@ -19,6 +19,8 @@ # iids: integer[] # class IssuableFinder + include CreatedAtFilter + NONE = '0'.freeze IRRELEVANT_PARAMS_FOR_CACHE_KEY = %i[utf8 sort page].freeze @@ -32,6 +34,7 @@ class IssuableFinder def execute items = init_collection items = by_scope(items) + items = by_created_at(items) items = by_state(items) items = by_group(items) items = by_search(items) @@ -42,7 +45,6 @@ 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) @@ -411,18 +413,6 @@ 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 |