Commit b33fb07e authored by Riccardo Padovani's avatar Riccardo Padovani Committed by Sean McGivern

Search issuables by iids

parent a25c637c
......@@ -104,6 +104,12 @@ module IssuableCollections
# Used by view to highlight active option
@sort = options[:sort]
# When a user looks for an exact iid, we do not filter by search but only by iid
if params[:search] =~ /^#(?<iid>\d+)\z/
options[:iids] = Regexp.last_match[:iid]
params[:search] = nil
end
if @project
options[:project_id] = @project.id
options[:attempt_project_search_optimizations] = true
......
---
title: "Search issuables by iids"
merge_request: !28302
author: Riccardo Padovani
type: fixed
......@@ -180,5 +180,16 @@ describe IssuableCollections do
is_expected.not_to include('invalid_param', 'invalid_array')
end
end
context 'search using an issue iid' do
let(:params) { { search: "#5" } }
it 'mutates the search into a filter by iid' do
is_expected.to include({
'iids' => '5',
'search' => nil
})
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