summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Balteanu <marius.balteanu@zitec.com>2022-11-29 07:16:37 +0000
committerMarius Balteanu <marius.balteanu@zitec.com>2022-11-29 07:16:37 +0000
commit5d0dc65ebe6489ef3d59f57636dd4845a142e374 (patch)
tree35087e4eb1d47aa7e81c3490c34480cb1fcfb7b6
parentee74f9b588028466a1cb70e53b6f4e0185efb023 (diff)
downloadredmine-5d0dc65ebe6489ef3d59f57636dd4845a142e374.tar.gz
redmine-5d0dc65ebe6489ef3d59f57636dd4845a142e374.zip
Merge r21965 from trunk to 4.2-stable (#37925).
git-svn-id: https://svn.redmine.org/redmine/branches/4.2-stable@21969 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/query.rb2
-rw-r--r--test/unit/query_test.rb14
2 files changed, 15 insertions, 1 deletions
diff --git a/app/models/query.rb b/app/models/query.rb
index fc8a44a77..7e3369730 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -1056,7 +1056,7 @@ class Query < ActiveRecord::Base
end
def display_type=(type)
- unless type || self.available_display_types.include?(type)
+ unless type && self.available_display_types.include?(type)
type = self.available_display_types.first
end
options[:display_type] = type
diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb
index 39a6a6505..bb1f01dbc 100644
--- a/test/unit/query_test.rb
+++ b/test/unit/query_test.rb
@@ -2713,4 +2713,18 @@ class QueryTest < ActiveSupport::TestCase
# Non-paginated issue ids and paginated issue ids should be in the same order.
assert_equal issue_ids, paginated_issue_ids
end
+
+ def test_display_type_should_accept_known_types
+ query = ProjectQuery.new(:name => '_')
+ query.display_type = 'list'
+
+ assert_equal 'list', query.display_type
+ end
+
+ def test_display_type_should_not_accept_unknown_types
+ query = ProjectQuery.new(:name => '_')
+ query.display_type = 'invalid'
+
+ assert_equal 'board', query.display_type
+ end
end