Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Fix rubocop error.

Dombi Attilac9935dd8213f
diff --git a/lib_static/plugins/acts_as_customizable/lib/acts_as_customizable.rb b/lib_static/plugins/acts_as_customizable/lib/acts_as_customizable.rb
index dd94b000dce..66c98a04238 100644
--- a/lib_static/plugins/acts_as_customizable/lib/acts_as_customizable.rb
+++ b/lib_static/plugins/acts_as_customizable/lib/acts_as_customizable.rb
@@ -268,10 +268,9 @@ module Redmine
# In order to construct a valid changes hash, we need to find the old value if it exists.
# Otherwise set it to nil.
- cfv_was = custom_values.find do |cv|
- cv.marked_for_destruction? && cv.custom_field_id == cfv.custom_field_id
- end
+ cfv_was = custom_value_was_for(cfv)
value_was = cfv_was&.value
+
# Skip when the old value equals the new value (no change happened).
next cfv_changes if value_was == cfv.value
@@ -285,6 +284,13 @@ module Redmine
changed + custom_field_changes.keys
end
+ def custom_value_was_for(custom_value)
+ custom_values.find do |cv|
+ cv.marked_for_destruction? &&
+ cv.custom_field_id == custom_value.custom_field_id
+ end
+ end
+
def add_custom_value_errors!(custom_value)
custom_value.errors.each do |error|
name = custom_value.custom_field.attribute_name.to_sym