Commit 965fd54b authored by Michael Kozono's avatar Michael Kozono

Merge branch 'jp-group-search2' into 'master'

Minor improvements of group search

See merge request gitlab-org/gitlab!66736
parents 385083ea a2fc2338
......@@ -100,7 +100,7 @@ class GroupsFinder < UnionFinder
def by_search(groups)
return groups unless params[:search].present?
groups.search(params[:search], include_parents: !params[:parent].present?)
groups.search(params[:search], include_parents: params[:parent].blank?)
end
# rubocop: enable CodeReuse/ActiveRecord
......
......@@ -243,7 +243,9 @@ RSpec.describe GroupsFinder do
end
it 'does not search in full path if parent is set' do
expect(described_class.new(user, { search: 'parent', parent: parent_group }).execute).to be_empty
matching_subgroup = create(:group, parent: parent_group, path: "#{parent_group.path}-subgroup")
expect(described_class.new(user, { search: 'parent', parent: parent_group }).execute).to contain_exactly(matching_subgroup)
end
context 'with group descendants' do
......
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