summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2023-04-18 12:05:49 +0000
committerGo MAEDA <maeda@farend.jp>2023-04-18 12:05:49 +0000
commitfae39a954207bd055f4fa492b4ed08de9efbaf62 (patch)
treec66575000c0e2b286e78a8958b49991c2bfef0f8 /test/unit
parent0e19e183b180388118feb3605e64a74f4243ff7d (diff)
downloadredmine-fae39a954207bd055f4fa492b4ed08de9efbaf62.tar.gz
redmine-fae39a954207bd055f4fa492b4ed08de9efbaf62.zip
Fix "Any searchable text" filter doesn't support the project filter with the value "my projects" or "my bookmarks" (#38402).
git-svn-id: https://svn.redmine.org/redmine/trunk@22203 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/query_test.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb
index 638ab5b17..283bb2e16 100644
--- a/test/unit/query_test.rb
+++ b/test/unit/query_test.rb
@@ -1041,6 +1041,36 @@ class QueryTest < ActiveSupport::TestCase
assert_equal [1, 3], result.map(&:id).sort
end
+ def test_filter_any_searchable_with_my_projects
+ # This user's project is ecookbook only
+ User.current = User.find_by(login: 'dlopper')
+ query = IssueQuery.new(
+ :name => '_',
+ :filters => {
+ 'any_searchable' => {:operator => '~', :values => ['issue']},
+ 'project_id' => {:operator => '=', :values => ['mine']}
+ }
+ )
+ result = find_issues_with_query(query)
+ assert_equal [7, 8, 11, 12], result.map(&:id).sort
+ result.each {|issue| assert_equal 1, issue.project_id}
+ end
+
+ def test_filter_any_searchable_with_my_bookmarks
+ # This user bookmarks two projects, ecookbook and private-child
+ User.current = User.find(1)
+ query = IssueQuery.new(
+ :name => '_',
+ :filters => {
+ 'any_searchable' => {:operator => '~', :values => ['issue']},
+ 'project_id' => {:operator => '=', :values => ['bookmarks']}
+ }
+ )
+ result = find_issues_with_query(query)
+ assert_equal [6, 7, 8, 9, 10, 11, 12], result.map(&:id).sort
+ result.each {|issue| assert_includes [1, 5], issue.project_id}
+ end
+
def test_filter_updated_by
user = User.generate!
Journal.create!(:user_id => user.id, :journalized => Issue.find(2), :notes => 'Notes')