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
fix unsetting the assignee/responsible on bulk copy
ulferts2c53db040fa7
diff --git a/app/controllers/work_packages/moves_controller.rb b/app/controllers/work_packages/moves_controller.rbindex ce3b342f85e..183ade3a331 100644--- a/app/controllers/work_packages/moves_controller.rb+++ b/app/controllers/work_packages/moves_controller.rb@@ -119,6 +119,8 @@ class WorkPackages::MovesController < ApplicationController.merge(type_id: params[:new_type_id],project_id: params[:new_project_id],journal_notes: params[:notes])- .reject { |_, v| v.blank? }+ .compact_blank+ # 'none' is used in the frontend as a value to unset the property, e.g. the assignee.+ .transform_values { |v| v == 'none' ? nil : v }endenddiff --git a/spec/features/work_packages/bulk/copy_work_package_spec.rb b/spec/features/work_packages/bulk/copy_work_package_spec.rbindex 007b76d9ed0..14b7c42276c 100644--- a/spec/features/work_packages/bulk/copy_work_package_spec.rb+++ b/spec/features/work_packages/bulk/copy_work_package_spec.rb@@ -16,7 +16,7 @@ describe 'Copy work packages through Rails view', js: true dofirstname: 'Dev',lastname: 'Guy',member_in_project: project,- member_with_permissions: %i[view_work_packages]+ member_with_permissions: %i[view_work_packages work_package_assigned]endshared_let(:mover) docreate :user,@@ -55,12 +55,14 @@ describe 'Copy work packages through Rails view', js: true dowp_table.visit!expect_angular_frontend_initializedwp_table.expect_work_package_listed work_package, work_package2-- # Select all work packages- find('body').send_keys [:control, 'a']enddescribe 'copying work packages' do+ before do+ # Select all work packages+ find('body').send_keys [:control, 'a']+ end+context 'with permission' dolet(:current_user) { mover }let(:wp_table_target) { ::Pages::WorkPackagesTable.new(project2) }@@ -192,6 +194,8 @@ describe 'Copy work packages through Rails view', js: true dobefore dodisplay_representation.switch_to_card_layoutloading_indicator_saveguard+ # Select all work packages+ find('body').send_keys [:control, 'a']endcontext 'with permissions' do@@ -212,4 +216,38 @@ describe 'Copy work packages through Rails view', js: true doendendend++ describe 'unsetting the assignee as the current assignee is not a member in the project' do+ let(:work_packages) { [work_package] }+ let(:current_user) { mover }+ let(:wp_table) { ::Pages::WorkPackagesTable.new(project) }++ before do+ work_package.assigned_to = dev+ work_package.save+ end++ it 'copies the work package' do+ context_menu.open_for work_package+ context_menu.choose 'Copy to other project'++ # On work packages move page+ select_autocomplete page.find('[data-qa-selector="new_project_id"]'),+ query: project2.name,+ select_text: project2.name,+ results_selector: 'body'++ select 'nobody', from: 'Assignee'++ click_on 'Copy and follow'++ expect(page)+ .to have_selector('.flash.notice',+ text: I18n.t(:notice_successful_create))++ wp_page = ::Pages::FullWorkPackage.new(WorkPackage.last)++ wp_page.expect_attributes assignee: '-'+ end+ endend