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.
This commit is contained in:
parent
c56326fc3e
commit
2c3c5b3554
|
@ -121,8 +121,10 @@ class GroupDescendantsFinder
|
|||
end
|
||||
|
||||
def direct_child_projects
|
||||
GroupProjectsFinder.new(group: parent_group, current_user: current_user, params: params)
|
||||
.execute
|
||||
GroupProjectsFinder.new(group: parent_group,
|
||||
current_user: current_user,
|
||||
options: { only_owned: true },
|
||||
params: params).execute
|
||||
end
|
||||
|
||||
# Finds all projects nested under `parent_group` or any of its descendant
|
||||
|
|
|
@ -35,6 +35,15 @@ describe GroupDescendantsFinder do
|
|||
expect(finder.execute).to contain_exactly(project)
|
||||
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
|
||||
let(:params) { { archived: 'true' } }
|
||||
|
||||
|
@ -64,7 +73,7 @@ describe GroupDescendantsFinder do
|
|||
end
|
||||
|
||||
context 'with a filter' do
|
||||
let(:params) { { filter: 'test' } }
|
||||
let(:params) { { filter: 'tes' } }
|
||||
|
||||
it 'includes only projects matching the filter' do
|
||||
_other_project = create(:project, namespace: group)
|
||||
|
|
Loading…
Reference in New Issue