Commit 0ebf1462 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'dz-hide-share-group-ancestors' into 'master'

Hide ancestor groups in the share group dropdown list

Closes #29311

See merge request !9965
parents 8548aaa0 e8942846
......@@ -9,6 +9,7 @@ module Projects
@skip_groups = @group_links.pluck(:group_id)
@skip_groups << @project.namespace_id unless @project.personal?
@skip_groups += @project.group.ancestors.pluck(:id) if @project.group
@project_members = MembersFinder.new(@project, current_user).execute
......
......@@ -207,7 +207,7 @@ class Group < Namespace
end
def members_with_parents
GroupMember.non_request.where(source_id: ancestors.map(&:id).push(id))
GroupMember.non_request.where(source_id: ancestors.pluck(:id).push(id))
end
def users_with_parents
......
---
title: Hide ancestor groups in the share group dropdown list
merge_request: 9965
author:
......@@ -8,7 +8,7 @@ feature 'Project group links', feature: true, js: true do
let!(:group) { create(:group) }
background do
project.team << [master, :master]
project.add_master(master)
login_as(master)
end
......@@ -29,4 +29,26 @@ feature 'Project group links', feature: true, js: true do
end
end
end
context 'nested group project' do
let!(:nested_group) { create(:group, parent: group) }
let!(:another_group) { create(:group) }
let!(:project) { create(:project, namespace: nested_group) }
background do
group.add_master(master)
another_group.add_master(master)
end
it 'does not show ancestors' do
visit namespace_project_settings_members_path(project.namespace, project)
click_link 'Search for a group'
page.within '.select2-drop' do
expect(page).to have_content(another_group.name)
expect(page).not_to have_content(group.name)
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment