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 setting custom CopyService contract_options:

Alexander Brandon Coles0d097223f535
diff --git a/app/services/projects/copy_service.rb b/app/services/projects/copy_service.rb
index 0885a94df22..0bdce9bc5a3 100644
--- a/app/services/projects/copy_service.rb
+++ b/app/services/projects/copy_service.rb
@@ -66,6 +66,10 @@ module Projects
count_source: ->(source, _) { source.work_packages.joins(:file_links).count("file_links.id") } }]
end
+ def initialize(contract_options: {}, **)
+ super(contract_options: contract_options.reverse_merge(validate_model: true), **)
+ end
+
protected
##
@@ -109,10 +113,6 @@ module Projects
call.result.project_custom_field_ids = source.project_custom_field_ids
end
- def contract_options
- { copy_source: source, validate_model: true }
- end
-
def retain_attributes(source, target)
# Ensure we keep the public value of the source project
# which might get overridden by the SetAttributesService