Commit 289ca35d authored by Sean McGivern's avatar Sean McGivern

Merge branch '#30974-issue-search-by-number' into 'master'

Search issuables by iids

Closes #39908 and #30974

See merge request gitlab-org/gitlab-ce!28302
parents a25c637c b33fb07e
......@@ -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