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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Ensure we set templated to false when copying
Oliver Günther6c6a05c7845c
diff --git a/app/services/projects/instantiate_template_service.rb b/app/services/projects/instantiate_template_service.rbindex b8301e3597c..298bb848a29 100644--- a/app/services/projects/instantiate_template_service.rb+++ b/app/services/projects/instantiate_template_service.rb@@ -44,7 +44,7 @@ module Projects::CopyProjectJob.perform_later(user_id: user.id,source_project_id: template_id,- target_project_params: params,+ target_project_params: project_params(params),# Copy all associationsassociations_to_copy: nil,# Send mails for now until we send our own mails@@ -59,5 +59,16 @@ module Projectsdef persist(call)callend++ private++ ##+ # Modifies params to ensure we unset+ # the templated option+ def project_params(params)+ params.to_h.merge(+ templated: false+ )+ endendenddiff --git a/app/workers/copy_project_job.rb b/app/workers/copy_project_job.rbindex 5dfde5f6fb9..2825269743b 100644--- a/app/workers/copy_project_job.rb+++ b/app/workers/copy_project_job.rb@@ -91,7 +91,8 @@ class CopyProjectJob < ApplicationJobif service_call.success? && target_project.saveerrors = copy_project_associations(target_project)else- errors = service_call.errors.merge(target_project.errors).full_messages+ service_call.errors.merge!(target_project.errors, nil)+ errors = service_call.errors.full_messagestarget_project = nillogger.error("Copying project fails with validation errors: #{errors.join("\n")}")enddiff --git a/spec/features/projects/project_status_administration_spec.rb b/spec/features/projects/project_status_administration_spec.rbindex c7c2e727666..e27be61170c 100644--- a/spec/features/projects/project_status_administration_spec.rb+++ b/spec/features/projects/project_status_administration_spec.rb@@ -45,8 +45,8 @@ describe 'Projects status administration', type: :feature, js: true do.and_return(r.id.to_s)endend- let(:create_status_description) { Components::WysiwygEditor.new('.form--field:nth-of-type(6)') }- let(:edit_status_description) { Components::WysiwygEditor.new('.form--field:nth-of-type(7)') }+ let(:create_status_description) { Components::WysiwygEditor.new('.form--field:nth-of-type(5)') }+ let(:edit_status_description) { Components::WysiwygEditor.new('.form--field:nth-of-type(6)') }before dologin_as current_userdiff --git a/spec/features/projects/template_spec.rb b/spec/features/projects/template_spec.rbindex a820a453e72..0ebf13f4de9 100644--- a/spec/features/projects/template_spec.rb+++ b/spec/features/projects/template_spec.rb@@ -94,6 +94,7 @@ describe 'Project templates', type: :feature, js: true doproject = Project.find_by identifier: 'foo'expect(project.name).to eq 'Foo bar'+ expect(project).not_to be_templatedexpect(project.users.first).to eq current_userexpect(project.enabled_module_names.sort).to eq(template.enabled_module_names.sort)