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:
Diffstat (limited to 'app/finders/group_projects_finder.rb')
-rw-r--r--app/finders/group_projects_finder.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/finders/group_projects_finder.rb b/app/finders/group_projects_finder.rb
index 8ab5072fdc6..dd8b2f29425 100644
--- a/app/finders/group_projects_finder.rb
+++ b/app/finders/group_projects_finder.rb
@@ -11,6 +11,7 @@
# options:
# only_owned: boolean
# only_shared: boolean
+# limit: integer
# params:
# sort: string
# visibility_level: int
@@ -20,6 +21,8 @@
# non_archived: boolean
#
class GroupProjectsFinder < ProjectsFinder
+ DEFAULT_PROJECTS_LIMIT = 100
+
attr_reader :group, :options
def initialize(group:, params: {}, options: {}, current_user: nil, project_ids_relation: nil)
@@ -32,8 +35,19 @@ class GroupProjectsFinder < ProjectsFinder
@options = options
end
+ def execute
+ collection = super
+ limit(collection)
+ end
+
private
+ def limit(collection)
+ limit = options[:limit]
+
+ limit.present? ? collection.with_limit(limit) : collection
+ end
+
def init_collection
projects = if current_user
collection_with_user