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-04-01 12:07:45 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-01 12:07:45 +0300
commitb11f7057d067885619ee3e513751f180b2e8ad85 (patch)
treedfb3077ea8716ed217f5ce4324be4e25a450c599 /app/finders
parente50050a8756a20b6aa118edbad3369674e4c63ba (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/projects_finder.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/app/finders/projects_finder.rb b/app/finders/projects_finder.rb
index 961694bd91f..2c3611875a2 100644
--- a/app/finders/projects_finder.rb
+++ b/app/finders/projects_finder.rb
@@ -21,6 +21,8 @@
# non_archived: boolean
# archived: 'only' or boolean
# min_access_level: integer
+# last_activity_after: datetime
+# last_activity_before: datetime
#
class ProjectsFinder < UnionFinder
include CustomAttributesFilter
@@ -73,6 +75,8 @@ class ProjectsFinder < UnionFinder
collection = by_archived(collection)
collection = by_custom_attributes(collection)
collection = by_deleted_status(collection)
+ collection = by_last_activity_after(collection)
+ collection = by_last_activity_before(collection)
collection
end
@@ -179,6 +183,22 @@ class ProjectsFinder < UnionFinder
params[:without_deleted].present? ? items.without_deleted : items
end
+ def by_last_activity_after(items)
+ if params[:last_activity_after].present?
+ items.where("last_activity_at > ?", params[:last_activity_after]) # rubocop: disable CodeReuse/ActiveRecord
+ else
+ items
+ end
+ end
+
+ def by_last_activity_before(items)
+ if params[:last_activity_before].present?
+ items.where("last_activity_at < ?", params[:last_activity_before]) # rubocop: disable CodeReuse/ActiveRecord
+ else
+ items
+ end
+ end
+
def sort(items)
params[:sort].present? ? items.sort_by_attribute(params[:sort]) : items.projects_order_id_desc
end