mirror of
https://github.com/meineerde/redmine.git
synced 2026-01-31 19:47:14 +00:00
Make the "Any searchable text" filter search only open issues when the status filter is set to "open" (#38402).
git-svn-id: https://svn.redmine.org/redmine/trunk@22221 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
88d4fcd270
commit
5352225a8c
@ -805,8 +805,11 @@ class IssueQuery < Query
|
||||
when '*~', '!~' then false
|
||||
end
|
||||
|
||||
is_open_issues = has_filter?('status_id') && operator_for('status_id') == 'o'
|
||||
|
||||
fetcher = Redmine::Search::Fetcher.new(
|
||||
question, User.current, ['issue'], projects, all_words: is_all_words, attachments: '0'
|
||||
question, User.current, ['issue'], projects,
|
||||
all_words: is_all_words, open_issues: is_open_issues, attachments: '0'
|
||||
)
|
||||
ids = fetcher.result_ids.map(&:last)
|
||||
if ids.present?
|
||||
|
||||
@ -1071,6 +1071,21 @@ class QueryTest < ActiveSupport::TestCase
|
||||
result.each {|issue| assert_includes [1, 5], issue.project_id}
|
||||
end
|
||||
|
||||
def test_filter_any_searchable_with_open_issues_should_search_only_open_issues
|
||||
User.current = User.find(1)
|
||||
query = IssueQuery.new(
|
||||
:name => '_',
|
||||
:filters => {
|
||||
'status_id' => {:operator => 'o'}
|
||||
}
|
||||
)
|
||||
|
||||
result = query.sql_for_any_searchable_field(nil, '~', ['issue'])
|
||||
assert_match /issues.id IN \([\d,]+\)/, result
|
||||
ids = result.scan(/\d+/).map(&:to_i).sort
|
||||
assert_equal [4, 5, 6, 7, 9, 10, 13, 14], ids
|
||||
end
|
||||
|
||||
def test_filter_updated_by
|
||||
user = User.generate!
|
||||
Journal.create!(:user_id => user.id, :journalized => Issue.find(2), :notes => 'Notes')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user