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
[33329] Set parent in changeset to ensure it gets saved
Oliver Güntherf0380bb5707a
diff --git a/frontend/src/app/components/wp-new/wp-create.component.ts b/frontend/src/app/components/wp-new/wp-create.component.tsindex 3fa686544d4..91316028efc 100644--- a/frontend/src/app/components/wp-new/wp-create.component.ts+++ b/frontend/src/app/components/wp-new/wp-create.component.ts@@ -124,9 +124,10 @@ export class WorkPackageCreateComponent extends UntilDestroyedMixin implements Othis.setTitle();if (this.stateParams['parent_id']) {- this.newWorkPackage.parent = {- href: this.pathHelper.api.v3.work_packages.id(this.stateParams['parent_id']).path- };+ changeset.setValue(+ 'parent',+ { href: this.pathHelper.api.v3.work_packages.id(this.stateParams['parent_id']).path }+ );}// Load the parent simply to display the type name :-/diff --git a/spec/features/work_packages/table/context_menu_spec.rb b/spec/features/work_packages/table/context_menu_spec.rbindex cdda73663e1..fcb5cb1866d 100644--- a/spec/features/work_packages/table/context_menu_spec.rb+++ b/spec/features/work_packages/table/context_menu_spec.rb@@ -130,6 +130,32 @@ describe 'Work package table context menu', js: true domenu.open_for(work_package)menu.expect_options ['Add predecessor', 'Add follower']end++ describe 'creating work packages' do+ let!(:priority) { FactoryBot.create :issue_priority, is_default: true }+ let!(:status) { FactoryBot.create :default_status }+ let!(:type) { FactoryBot.create :type_task }+ let!(:project) { FactoryBot.create :project, types: [type] }+ let!(:work_package) { FactoryBot.create :work_package, project: project, type: type, status: status, priority: priority }+ let(:wp_table) { Pages::WorkPackagesTable.new project }++ it 'can create a new child from the context menu (Regression #33329)' do+ goto_context_menu true+ menu.choose('Create new child')+ expect(page).to have_selector('.inline-edit--container.subject input')+ expect(current_url).to match(/.*\/create_new\?.*(\&)*parent_id=#{work_package.id.to_s}/)++ split_view = ::Pages::SplitWorkPackageCreate.new project: work_package.project+ subject = split_view.edit_field(:subject)+ subject.set_value 'Child task'+ subject.submit_by_enter++ split_view.expect_and_dismiss_notification message: 'Successful creation.'+ expect(page).to have_selector('.wp-breadcrumb', text: "Parent:\n#{work_package.subject}")+ wp = WorkPackage.last+ expect(wp.parent).to eq work_package+ end+ endendcontext 'in the card view' do