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

Move reset_section_scoped_validations method to Projects::UpdateService

Dombi Attilab392af07827a
diff --git a/app/models/projects/acts_as_customizable_patches.rb b/app/models/projects/acts_as_customizable_patches.rb
index dec980b246f..b6d26e7f8a3 100644
--- a/app/models/projects/acts_as_customizable_patches.rb
+++ b/app/models/projects/acts_as_customizable_patches.rb
@@ -41,14 +41,6 @@ module Projects::ActsAsCustomizablePatches
before_update :set_query_available_custom_fields_to_global_level
- after_save :reset_section_scoped_validation
-
- def reset_section_scoped_validation
- # reset the section scope after saving
- # in order not to silently carry this setting in this instance
- self._limit_custom_fields_validation_to_section_id = nil
- end
-
def set_query_available_custom_fields_to_global_level
# query the available custom fields on a global level when updating custom field values
# in order to support implicit activation of custom fields when values are provided during an update
diff --git a/app/services/projects/update_service.rb b/app/services/projects/update_service.rb
index 573b90ce8fc..3394f75973f 100644
--- a/app/services/projects/update_service.rb
+++ b/app/services/projects/update_service.rb
@@ -47,6 +47,7 @@ module Projects
def after_perform(service_call)
ret = super
+ reset_section_scoped_validation
touch_on_custom_values_update
notify_on_identifier_renamed
send_update_notification
@@ -97,5 +98,11 @@ module Projects
service = service_class.new(user:, model:, contract_class: EmptyContract)
service.call
end
+
+ def reset_section_scoped_validation
+ # reset the section scope after saving
+ # in order not to silently carry this setting in this instance
+ model._limit_custom_fields_validation_to_section_id = nil
+ end
end
end