diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-04-08 07:39:30 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-04-08 07:39:30 +0000 |
commit | ffd1ebda982dada6cb0f676761a5f0d811238cd2 (patch) | |
tree | 1f540fb52c3674e30a1c4f81390cfe520484b9af | |
parent | 0ffeec672c9310d5c946decb6f0cf3c734468265 (diff) | |
download | redmine-ffd1ebda982dada6cb0f676761a5f0d811238cd2.tar.gz redmine-ffd1ebda982dada6cb0f676761a5f0d811238cd2.zip |
Merged r16504 (#25478).
git-svn-id: http://svn.redmine.org/redmine/branches/3.2-stable@16522 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/models/issue_query.rb | 2 | ||||
-rw-r--r-- | test/unit/query_test.rb | 16 |
2 files changed, 16 insertions, 2 deletions
diff --git a/app/models/issue_query.rb b/app/models/issue_query.rb index c97de0a19..29d3118ac 100644 --- a/app/models/issue_query.rb +++ b/app/models/issue_query.rb @@ -538,7 +538,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 diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb index 433691808..a58351d37 100644 --- a/test/unit/query_test.rb +++ b/test/unit/query_test.rb @@ -860,7 +860,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)) @@ -874,6 +874,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)) |