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>2022-12-20 17:22:11 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-12-20 17:22:11 +0300
commit0c872e02b2c822e3397515ec324051ff540f0cd5 (patch)
treece2fb6ce7030e4dad0f4118d21ab6453e5938cdd /lib/gitlab/group_search_results.rb
parentf7e05a6853b12f02911494c4b3fe53d9540d74fc (diff)
Add latest changes from gitlab-org/gitlab@15-7-stable-eev15.7.0-rc42
Diffstat (limited to 'lib/gitlab/group_search_results.rb')
-rw-r--r--lib/gitlab/group_search_results.rb16
1 files changed, 2 insertions, 14 deletions
diff --git a/lib/gitlab/group_search_results.rb b/lib/gitlab/group_search_results.rb
index 4eea96f8344..b112740c4ad 100644
--- a/lib/gitlab/group_search_results.rb
+++ b/lib/gitlab/group_search_results.rb
@@ -12,23 +12,11 @@ module Gitlab
# rubocop:disable CodeReuse/ActiveRecord
def users
- # get all groups the current user has access to
- # ignore order inherited from GroupsFinder to improve performance
- current_user_groups = GroupsFinder.new(current_user).execute.unscope(:order)
+ groups = group.self_and_hierarchy_intersecting_with_user_groups(current_user)
+ members = GroupMember.where(group: groups).non_invite
- # the hierarchy of the current group
- group_groups = @group.self_and_hierarchy.unscope(:order)
-
- # the groups where the above hierarchies intersect
- intersect_groups = group_groups.where(id: current_user_groups)
-
- # members of @group hierarchy where the user has access to the groups
- members = GroupMember.where(group: intersect_groups).non_invite
-
- # get all users the current user has access to (-> `SearchResults#users`), which also applies the query
users = super
- # filter users that belong to the previously selected groups
users.where(id: members.select(:user_id))
end
# rubocop:enable CodeReuse/ActiveRecord