From b76ae638462ab0f673e5915986070518dd3f9ad3 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 19 Aug 2021 09:08:42 +0000 Subject: Add latest changes from gitlab-org/gitlab@14-2-stable-ee --- app/finders/groups_finder.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'app/finders/groups_finder.rb') 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 -- cgit v1.2.1