summaryrefslogtreecommitdiff
path: root/app/finders
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2017-07-07 09:29:00 +0200
committerJames Lopez <james@jameslopez.es>2017-07-07 10:38:57 +0200
commit1a7d2aba3b06a1e4fcc3861eeb70af30fc3330f6 (patch)
tree749815838ad52bc4547f4d6d28f56a8e623fe319 /app/finders
parentb08df253ef16d635883451aafeb71b4a6f4ccd09 (diff)
downloadgitlab-ce-1a7d2aba3b06a1e4fcc3861eeb70af30fc3330f6.tar.gz
add created at filter logic to users finder and API
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/users_finder.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/finders/users_finder.rb b/app/finders/users_finder.rb
index 07deceb827b..ae031162892 100644
--- a/app/finders/users_finder.rb
+++ b/app/finders/users_finder.rb
@@ -29,6 +29,7 @@ class UsersFinder
users = by_active(users)
users = by_external_identity(users)
users = by_external(users)
+ users = by_created_at(users)
users
end
@@ -71,4 +72,16 @@ class UsersFinder
users.external
end
+
+ def by_created_at(users)
+ if params[:created_after].present?
+ users = users.where(users.klass.arel_table[:created_at].gteq(params[:created_after]))
+ end
+
+ if params[:created_before].present?
+ users = users.where(users.klass.arel_table[:created_at].lteq(params[:created_before]))
+ end
+
+ users
+ end
end