summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/custom_field.rb4
-rw-r--r--app/models/issue_custom_field.rb2
-rw-r--r--test/functional/timelog_controller_test.rb11
3 files changed, 16 insertions, 1 deletions
diff --git a/app/models/custom_field.rb b/app/models/custom_field.rb
index c2b717d0e..f469bc534 100644
--- a/app/models/custom_field.rb
+++ b/app/models/custom_field.rb
@@ -76,6 +76,10 @@ class CustomField < ActiveRecord::Base
CUSTOM_FIELDS_NAMES = CUSTOM_FIELDS_TABS.collect{|v| v[:name]}
+ def visible_by?(project, user=User.current)
+ visible? || user.admin?
+ end
+
def field_format=(arg)
# cannot change format of a saved custom field
super if new_record?
diff --git a/app/models/issue_custom_field.rb b/app/models/issue_custom_field.rb
index 9ddedc882..e811ccaae 100644
--- a/app/models/issue_custom_field.rb
+++ b/app/models/issue_custom_field.rb
@@ -25,7 +25,7 @@ class IssueCustomField < CustomField
end
def visible_by?(project, user=User.current)
- visible? || user.admin? || (roles & user.roles_for_project(project)).present?
+ super || (roles & user.roles_for_project(project)).present?
end
def validate_custom_field
diff --git a/test/functional/timelog_controller_test.rb b/test/functional/timelog_controller_test.rb
index 2cc9bf778..5735260ca 100644
--- a/test/functional/timelog_controller_test.rb
+++ b/test/functional/timelog_controller_test.rb
@@ -548,6 +548,17 @@ class TimelogControllerTest < ActionController::TestCase
assert_select 'td.issue_cf_2', :text => 'filter_on_issue_custom_field'
end
+ def test_index_with_time_entry_custom_field_column
+ field = TimeEntryCustomField.generate!(:field_format => 'string')
+ entry = TimeEntry.generate!(:hours => 2.5, :custom_field_values => {field.id => 'CF Value'})
+ field_name = "cf_#{field.id}"
+
+ get :index, :c => ["hours", field_name]
+ assert_response :success
+ assert_include field_name.to_sym, assigns(:query).column_names
+ assert_select "td.#{field_name}", :text => 'CF Value'
+ end
+
def test_index_atom_feed
get :index, :project_id => 1, :format => 'atom'
assert_response :success