From 382ca5055a3a28726b5b66cb79856fbeaaaf73e9 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Fri, 2 May 2014 07:32:41 +0000 Subject: Field set as read-only still available in the issues list context menu (#16755). git-svn-id: http://svn.redmine.org/redmine/trunk@13124 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/context_menus_controller.rb | 2 +- app/models/issue.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/controllers/context_menus_controller.rb b/app/controllers/context_menus_controller.rb index a17304880..2b174c016 100644 --- a/app/controllers/context_menus_controller.rb +++ b/app/controllers/context_menus_controller.rb @@ -55,7 +55,7 @@ class ContextMenusController < ApplicationController @options_by_custom_field = {} if @can[:edit] - custom_fields = @issues.map(&:available_custom_fields).reduce(:&).reject(&:multiple?) + custom_fields = @issues.map(&:editable_custom_fields).reduce(:&).reject(&:multiple?) custom_fields.each do |field| values = field.possible_values_options(@projects) if values.present? diff --git a/app/models/issue.rb b/app/models/issue.rb index 96c2b2197..3a3373ffd 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -483,6 +483,11 @@ class Issue < ActiveRecord::Base end end + # Returns the custom fields that can be edited by the given user + def editable_custom_fields(user=nil) + editable_custom_field_values(user).map(&:custom_field).uniq + end + # Returns the names of attributes that are read-only for user or the current user # For users with multiple roles, the read-only fields are the intersection of # read-only fields of each role -- cgit v1.2.3