Don't include the parent in search results if it matches
This commit is contained in:
parent
79cc3c8e3e
commit
6388b8feec
|
@ -52,7 +52,7 @@ class GroupChildrenFinder
|
|||
end
|
||||
|
||||
def subgroups_matching_filter
|
||||
all_subgroups.search(params[:filter])
|
||||
all_subgroups.where.not(id: parent_group).search(params[:filter])
|
||||
end
|
||||
|
||||
def subgroups
|
||||
|
|
|
@ -60,6 +60,12 @@ describe GroupChildrenFinder do
|
|||
|
||||
expect(finder.execute).to contain_exactly(matching_project)
|
||||
end
|
||||
|
||||
it 'does not include the parent itself' do
|
||||
group.update!(name: 'test')
|
||||
|
||||
expect(finder.execute).not_to include(group)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue