Commit 6388b8fe authored by Bob Van Landuyt's avatar Bob Van Landuyt

Don't include the parent in search results if it matches

parent 79cc3c8e
...@@ -52,7 +52,7 @@ class GroupChildrenFinder ...@@ -52,7 +52,7 @@ class GroupChildrenFinder
end end
def subgroups_matching_filter def subgroups_matching_filter
all_subgroups.search(params[:filter]) all_subgroups.where.not(id: parent_group).search(params[:filter])
end end
def subgroups def subgroups
......
...@@ -60,6 +60,12 @@ describe GroupChildrenFinder do ...@@ -60,6 +60,12 @@ describe GroupChildrenFinder do
expect(finder.execute).to contain_exactly(matching_project) expect(finder.execute).to contain_exactly(matching_project)
end end
it 'does not include the parent itself' do
group.update!(name: 'test')
expect(finder.execute).not_to include(group)
end
end end
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