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
Merge branch 'release/15.1' into release/15.2
Christophe Bliardde565583b2c8
diff --cc app/controllers/work_package_children_relations_controller.rbindex 17cc55f9548,2f1fb1574e5..83cc2288772--- a/app/controllers/work_package_children_relations_controller.rb+++ b/app/controllers/work_package_children_relations_controller.rb@@@ -46,39 -43,33 +43,34 @@@ class WorkPackageChildrenRelationsContrenddef create- target_work_package_id = params[:work_package][:id]- target_child_work_package = WorkPackage.find(target_work_package_id)+ child = WorkPackage.find(params[:work_package][:id])+ service_result = set_relation(child:, parent: @work_package)- target_child_work_package.parent = @work_package- respond_with_relations_tab_update(service_result)++ respond_with_relations_tab_update(service_result, scroll_to_id: target_work_package_id)+ end- if target_child_work_package.save- @children = @work_package.children.visible- @relations = @work_package.relations.visible+ def destroy+ child = WorkPackage.find(params[:id])+ service_result = set_relation(child:, parent: nil)- component = WorkPackageRelationsTab::IndexComponent.new(- work_package: @work_package,- relations: @relations,- children: @children,- scroll_to_id: target_work_package_id- )- replace_via_turbo_stream(component:)- update_flash_message_via_turbo_stream(- message: I18n.t(:notice_successful_update), scheme: :success- )- respond_with_turbo_streams- end+ respond_with_relations_tab_update(service_result)end- def destroy- @child.parent = nil+ private- if @child.save+ def set_relation(child:, parent:)+ WorkPackages::UpdateService.new(user: current_user, model: child)+ .call(parent:)+ end+- def respond_with_relations_tab_update(service_result)++ def respond_with_relations_tab_update(service_result, **)+ if service_result.success?@work_package.reload- @children = @work_package.children.visiblecomponent = WorkPackageRelationsTab::IndexComponent.new(work_package: @work_package,- relations: @relations,- children: @children+ relations: @work_package.relations.visible,- children: @work_package.children.visible++ children: @work_package.children.visible,++ **)replace_via_turbo_stream(component:)update_flash_message_via_turbo_stream(diff --cc app/controllers/work_package_relations_controller.rbindex ca2b6bc06b4,6be607a1669..7d3baa85d73--- a/app/controllers/work_package_relations_controller.rb+++ b/app/controllers/work_package_relations_controller.rb@@@ -60,12 -60,10 +60,12 @@@ class WorkPackageRelationsController <.call(create_relation_params)if service_result.success?+ target_work_package_id = params[:relation][:to_id]@work_package.reloadcomponent = WorkPackageRelationsTab::IndexComponent.new(work_package: @work_package,- relations: @work_package.relations,- children: @work_package.children,+ relations: @work_package.relations.visible,- children: @work_package.children.visible)++ children: @work_package.children.visible,+ scroll_to_id: target_work_package_id)replace_via_turbo_stream(component:)respond_with_turbo_streamselsediff --cc spec/features/work_packages/details/relations/primerized_relations_spec.rbindex 280045e8fae,e15ff4192cc..6dbd2958c8b--- a/spec/features/work_packages/details/relations/primerized_relations_spec.rb+++ b/spec/features/work_packages/details/relations/primerized_relations_spec.rb@@@ -83,6 -93,28 +93,27 @@@ RSpec.describe "Primerized work packagproject:)end+ # The user should not be able to see any relations to work packages from this+ # project because the user does not have the permissions to view this project+ shared_let(:restricted_project) { create(:project) }+ shared_let(:restricted_work_package) do+ create(:work_package,+ subject: "restricted_work_package",+ project: restricted_project)+ end+ shared_let(:restricted_child_work_package) do+ create(:work_package,+ subject: "restricted_child_work_package",+ parent: work_package,+ project: restricted_project)+ end+ shared_let(:restricted_relation_relates) do+ create(:relation,+ from: work_package,+ to: restricted_work_package,+ relation_type: Relation::TYPE_RELATES)+ end+- let(:full_wp_view) { Pages::FullWorkPackage.new(work_package) }let(:relations_tab) { Components::WorkPackages::Relations.new(work_package) }let(:relations_panel_selector) { ".detail-panel--relations" }let(:relations_panel) { find(relations_panel_selector) }