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
This commit is contained in:
commit
289ca35df4
|
@ -104,6 +104,12 @@ module IssuableCollections
|
||||||
# Used by view to highlight active option
|
# Used by view to highlight active option
|
||||||
@sort = options[:sort]
|
@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
|
if @project
|
||||||
options[:project_id] = @project.id
|
options[:project_id] = @project.id
|
||||||
options[:attempt_project_search_optimizations] = true
|
options[:attempt_project_search_optimizations] = true
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
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')
|
is_expected.not_to include('invalid_param', 'invalid_array')
|
||||||
end
|
end
|
||||||
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
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue