]> source.dussan.org Git - redmine.git/commitdiff
Issue#editable_custom_field_values very slow for issues with many custom fields ...
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 20 Aug 2016 11:38:27 +0000 (11:38 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 20 Aug 2016 11:38:27 +0000 (11:38 +0000)
Patch by Stephane Evr.

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

app/models/issue.rb

index 0b8a2b2c5b678024f65b4879188c12058cc15c3f..a8d5e52b704897b792d967cb7aa5857ec6863942 100644 (file)
@@ -574,8 +574,9 @@ class Issue < ActiveRecord::Base
 
   # Returns the custom_field_values that can be edited by the given user
   def editable_custom_field_values(user=nil)
+    read_only = read_only_attribute_names(user)
     visible_custom_field_values(user).reject do |value|
-      read_only_attribute_names(user).include?(value.custom_field_id.to_s)
+      read_only.include?(value.custom_field_id.to_s)
     end
   end