1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-02-06 09:03:25 +00:00

Query display types should accept only known types (#37925).

Patch by Alexander Meindl.


git-svn-id: https://svn.redmine.org/redmine/trunk@21965 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Marius Balteanu 2022-11-28 22:41:53 +00:00
parent 1242f8d48a
commit 7c80efae71
2 changed files with 15 additions and 1 deletions

View File

@ -1065,7 +1065,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

View File

@ -2880,4 +2880,18 @@ class QueryTest < ActiveSupport::TestCase
assert_equal 1, query.issue_count
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