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/groups_finder.rb')
-rw-r--r--app/finders/groups_finder.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/finders/groups_finder.rb b/app/finders/groups_finder.rb
index 4b6b2716c64..7ea3362fba1 100644
--- a/app/finders/groups_finder.rb
+++ b/app/finders/groups_finder.rb
@@ -11,6 +11,7 @@
# parent: Group
# all_available: boolean (defaults to true)
# min_access_level: integer
+# search: string
# exclude_group_ids: array of integers
# include_parent_descendants: boolean (defaults to false) - includes descendant groups when
# filtering by parent. The parent param must be present.
@@ -33,6 +34,7 @@ class GroupsFinder < UnionFinder
item = by_parent(item)
item = by_custom_attributes(item)
item = exclude_group_ids(item)
+ item = by_search(item)
item
end
@@ -94,6 +96,14 @@ class GroupsFinder < UnionFinder
end
# rubocop: enable CodeReuse/ActiveRecord
+ # rubocop: disable CodeReuse/ActiveRecord
+ def by_search(groups)
+ return groups unless params[:search].present?
+
+ groups.search(params[:search], include_parents: params[:parent].blank?)
+ end
+ # rubocop: enable CodeReuse/ActiveRecord
+
def owned_groups
current_user&.owned_groups || Group.none
end