mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-29 11:49:37 +00:00
Fixed that related to "no open issues" filter shows all issues (#25478).
Patch by Kevin Fischer. git-svn-id: http://svn.redmine.org/redmine/trunk@16504 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
8813de93b3
commit
dd37b8cfb6
@ -548,7 +548,7 @@ class IssueQuery < Query
|
||||
|
||||
if relation_options[:sym] == field && !options[:reverse]
|
||||
sqls = [sql, sql_for_relations(field, operator, value, :reverse => true)]
|
||||
sql = sqls.join(["!", "!*", "!p"].include?(operator) ? " AND " : " OR ")
|
||||
sql = sqls.join(["!", "!*", "!p", '!o'].include?(operator) ? " AND " : " OR ")
|
||||
end
|
||||
"(#{sql})"
|
||||
end
|
||||
|
||||
@ -1100,7 +1100,7 @@ class QueryTest < ActiveSupport::TestCase
|
||||
assert_include 2, ids
|
||||
end
|
||||
|
||||
def test_filter_on_relations_with_no_open_issues
|
||||
def test_filter_on_blocked_by_no_open_issues
|
||||
IssueRelation.delete_all
|
||||
# Issue 1 is blocked by 8, which is closed
|
||||
IssueRelation.create!(:relation_type => "blocked", :issue_from => Issue.find(1), :issue_to => Issue.find(8))
|
||||
@ -1114,6 +1114,20 @@ class QueryTest < ActiveSupport::TestCase
|
||||
assert_include 1, ids
|
||||
end
|
||||
|
||||
def test_filter_on_related_with_no_open_issues
|
||||
IssueRelation.delete_all
|
||||
# Issue 1 is blocked by 8, which is closed
|
||||
IssueRelation.create!(relation_type: 'relates', issue_from: Issue.find(1), issue_to: Issue.find(8))
|
||||
# Issue 2 is blocked by 3, which is open
|
||||
IssueRelation.create!(relation_type: 'relates', issue_from: Issue.find(2), issue_to: Issue.find(3))
|
||||
|
||||
query = IssueQuery.new(:name => '_')
|
||||
query.filters = { 'relates' => { operator: '!o', values: [''] } }
|
||||
ids = find_issues_with_query(query).map(&:id)
|
||||
assert_equal [], ids & [2]
|
||||
assert_include 1, ids
|
||||
end
|
||||
|
||||
def test_filter_on_relations_with_no_issues
|
||||
IssueRelation.delete_all
|
||||
IssueRelation.create!(:relation_type => "relates", :issue_from => Issue.find(1), :issue_to => Issue.find(2))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user