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 Attilacf6040e2e43c
diff --git a/app/services/projects/copy/work_packages_dependent_service.rb b/app/services/projects/copy/work_packages_dependent_service.rb
index f8380584f82..873e7e838c2 100644
--- a/app/services/projects/copy/work_packages_dependent_service.rb
+++ b/app/services/projects/copy/work_packages_dependent_service.rb
@@ -127,21 +127,13 @@ module Projects::Copy
end
def copy_work_package_attribute_overrides(source_work_package, parent_id, user_cf_ids)
- custom_value_attributes = source_work_package.custom_value_attributes.map do |id, value|
- if user_cf_ids.include?(id) && !target.users.detect { |u| u.id.to_s == value }
- [id, nil]
- else
- [id, value]
- end
- end.to_h
-
{
project: target,
parent_id:,
version_id: work_package_version_id(source_work_package),
assigned_to_id: work_package_assigned_to_id(source_work_package),
responsible_id: work_package_responsible_id(source_work_package),
- custom_field_values: custom_value_attributes,
+ custom_field_values: custom_value_attributes(source_work_package, user_cf_ids),
# We don't support copying budgets right now
budget_id: nil,
@@ -166,6 +158,16 @@ module Projects::Copy
source_work_package.project)
end
+ def custom_value_attributes(source_work_package, user_cf_ids)
+ source_work_package.custom_value_attributes.to_h do |id, value|
+ if user_cf_ids.include?(id) && !target.users.detect { |u| u.id.to_s == value }
+ [id, nil]
+ else
+ [id, value]
+ end
+ end
+ end
+
def possible_principal_id(principal_id, project)
return unless principal_id