]> source.dussan.org Git - redmine.git/commitdiff
Merged r20783 from trunk to 4.1-stable (#33548).
authorGo MAEDA <maeda@farend.jp>
Sun, 14 Mar 2021 06:57:54 +0000 (06:57 +0000)
committerGo MAEDA <maeda@farend.jp>
Sun, 14 Mar 2021 06:57:54 +0000 (06:57 +0000)
git-svn-id: http://svn.redmine.org/redmine/branches/4.1-stable@20784 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/query.rb
test/unit/query_test.rb

index a57cfe442b04abba9f215bf7730bd4d2bcda4bcb..152b11cf16dedf6efeb3de83ff553861337164c8 100644 (file)
@@ -51,7 +51,7 @@ class QueryColumn
 
   # Returns true if the column is sortable, otherwise false
   def sortable?
-    !@sortable.nil?
+    @sortable.present?
   end
 
   def sortable
index fcb554ecf0aa49ed7b34452d9c1c82e5b6f538f8..d080ad84658d60dcfb13a4262062848869c144a0 100644 (file)
@@ -1630,6 +1630,16 @@ class QueryTest < ActiveSupport::TestCase
     assert !q.sortable_columns['cf_1']
   end
 
+  def test_sortable_should_return_false_for_multi_custom_field
+    field = CustomField.find(1)
+    field.update_attribute :multiple, true
+
+    q = IssueQuery.new
+
+    field_column = q.available_columns.detect {|c| c.name==:cf_1}
+    assert !field_column.sortable?
+  end
+
   def test_default_sort
     q = IssueQuery.new
     assert_equal [['id', 'desc']], q.sort_criteria