Commit f5365520 authored by jplang's avatar jplang

Fixed that Query#has_column? returns false with default columns.

git-svn-id: https://svn.redmine.org/redmine/trunk@16217 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 0d7dc740
......@@ -679,7 +679,8 @@ class Query < ActiveRecord::Base
end
def has_column?(column)
column_names && column_names.include?(column.is_a?(QueryColumn) ? column.name : column)
name = column.is_a?(QueryColumn) ? column.name : column
columns.detect {|c| c.name == name}
end
def has_custom_field_column?
......
......@@ -1170,6 +1170,14 @@ class QueryTest < ActiveSupport::TestCase
assert !q.has_column?(category_column)
end
def test_has_column_should_return_true_for_default_column
with_settings :issue_list_default_columns => %w(tracker subject) do
q = IssueQuery.new
assert q.has_column?(:tracker)
assert !q.has_column?(:category)
end
end
def test_inline_and_block_columns
q = IssueQuery.new
q.column_names = ['subject', 'description', 'tracker']
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment