]> source.dussan.org Git - redmine.git/commitdiff
Fix that column header is clickable even when the column is not actually sortable...
authorGo MAEDA <maeda@farend.jp>
Sun, 14 Mar 2021 03:14:49 +0000 (03:14 +0000)
committerGo MAEDA <maeda@farend.jp>
Sun, 14 Mar 2021 03:14:49 +0000 (03:14 +0000)
Patch by Vincent Robert and Marius BALTEANU.

git-svn-id: http://svn.redmine.org/redmine/trunk@20783 e93f8b46-1217-0410-a6f0-8f06a7374b81

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

index f81f5782a82abed884610bda9fe29cfa24c1beb8..dc610f41e38236fd7c6d28cf77ea834c8b73ced2 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 a6dff724c819ab7c44220d9ffd42bcec90587069..f590cd4dcb3069c7ff3e04a32ac41bcef78c53e7 100644 (file)
@@ -1707,6 +1707,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