Commit 2c3c5b35 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Don't include projects shared as group-descendants

When a project is shared with a group, it should not be included as a
descendant on the group dashboard.
parent c56326fc
...@@ -121,8 +121,10 @@ class GroupDescendantsFinder ...@@ -121,8 +121,10 @@ class GroupDescendantsFinder
end end
def direct_child_projects def direct_child_projects
GroupProjectsFinder.new(group: parent_group, current_user: current_user, params: params) GroupProjectsFinder.new(group: parent_group,
.execute current_user: current_user,
options: { only_owned: true },
params: params).execute
end end
# Finds all projects nested under `parent_group` or any of its descendant # Finds all projects nested under `parent_group` or any of its descendant
......
...@@ -35,6 +35,15 @@ describe GroupDescendantsFinder do ...@@ -35,6 +35,15 @@ describe GroupDescendantsFinder do
expect(finder.execute).to contain_exactly(project) expect(finder.execute).to contain_exactly(project)
end end
it 'does not include projects shared with the group' do
project = create(:project, namespace: group)
other_project = create(:project)
other_project.project_group_links.create(group: group,
group_access: ProjectGroupLink::MASTER)
expect(finder.execute).to contain_exactly(project)
end
context 'when archived is `true`' do context 'when archived is `true`' do
let(:params) { { archived: 'true' } } let(:params) { { archived: 'true' } }
...@@ -64,7 +73,7 @@ describe GroupDescendantsFinder do ...@@ -64,7 +73,7 @@ describe GroupDescendantsFinder do
end end
context 'with a filter' do context 'with a filter' do
let(:params) { { filter: 'test' } } let(:params) { { filter: 'tes' } }
it 'includes only projects matching the filter' do it 'includes only projects matching the filter' do
_other_project = create(:project, namespace: group) _other_project = create(:project, namespace: group)
......
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