diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
commit | 3cccd102ba543e02725d247893729e5c73b38295 (patch) | |
tree | f36a04ec38517f5deaaacb5acc7d949688d1e187 /app/helpers/groups/group_members_helper.rb | |
parent | 205943281328046ef7b4528031b90fbda70c75ac (diff) |
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'app/helpers/groups/group_members_helper.rb')
-rw-r--r-- | app/helpers/groups/group_members_helper.rb | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/app/helpers/groups/group_members_helper.rb b/app/helpers/groups/group_members_helper.rb index a719d80a1a1..80ab303357b 100644 --- a/app/helpers/groups/group_members_helper.rb +++ b/app/helpers/groups/group_members_helper.rb @@ -9,10 +9,10 @@ module Groups::GroupMembersHelper { multiple: true, class: 'input-clamp qa-member-select-field ', scope: :all, email_user: true } end - def group_members_app_data(group, members:, invited:, access_requests:) + def group_members_app_data(group, members:, invited:, access_requests:, include_relations:, search:) { user: group_members_list_data(group, members, { param_name: :page, params: { invited_members_page: nil, search_invited: nil } }), - group: group_group_links_list_data(group), + group: group_group_links_list_data(group, include_relations, search), invite: group_members_list_data(group, invited.nil? ? [] : invited, { param_name: :invited_members_page, params: { page: nil } }), access_request: group_members_list_data(group, access_requests.nil? ? [] : access_requests), source_id: group.id, @@ -26,8 +26,8 @@ module Groups::GroupMembersHelper MemberSerializer.new.represent(members, { current_user: current_user, group: group, source: group }) end - def group_group_links_serialized(group_links) - GroupLink::GroupGroupLinkSerializer.new.represent(group_links, { current_user: current_user }) + def group_group_links_serialized(group, group_links) + GroupLink::GroupGroupLinkSerializer.new.represent(group_links, { current_user: current_user, source: group }) end # Overridden in `ee/app/helpers/ee/groups/group_members_helper.rb` @@ -39,11 +39,29 @@ module Groups::GroupMembersHelper } end - def group_group_links_list_data(group) - group_links = group.shared_with_group_links + def group_group_links(group, include_relations) + group_links = case include_relations + when [:direct] + group.shared_with_group_links + when [:inherited] + group.shared_with_group_links.of_ancestors + else + group.shared_with_group_links.of_ancestors_and_self + end + + group_links.distinct_on_shared_with_group_id_with_group_access + end + + def group_group_links_list_data(group, include_relations, search) + if ::Feature.enabled?(:group_member_inherited_group, group, default_enabled: :yaml) + group_links = group_group_links(group, include_relations) + group_links = group_links.search(search) if search + else + group_links = group.shared_with_group_links + end { - members: group_group_links_serialized(group_links), + members: group_group_links_serialized(group, group_links), pagination: members_pagination_data(group_links), member_path: group_group_link_path(group, ':id') } |