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
use post instead of put for reordering hierarchy items
Bruno Pagno69755e2b6b49
diff --git a/app/components/admin/custom_fields/hierarchy/item_component.rb b/app/components/admin/custom_fields/hierarchy/item_component.rbindex d009b85de81..787c9749025 100644--- a/app/components/admin/custom_fields/hierarchy/item_component.rb+++ b/app/components/admin/custom_fields/hierarchy/item_component.rb@@ -112,7 +112,7 @@ module Admintag: :button,href: move_custom_field_item_path(@root.custom_field_id, model),content_arguments: { data: { turbo_frame: ItemsComponent.wrapper_key } },- form_arguments: { method: :put, inputs: form_inputs }) do |item|+ form_arguments: { method: :post, inputs: form_inputs }) do |item|item.with_leading_visual_icon(icon: "chevron-up")endend@@ -124,7 +124,7 @@ module Admintag: :button,href: move_custom_field_item_path(@root.custom_field_id, model),content_arguments: { data: { turbo_frame: ItemsComponent.wrapper_key } },- form_arguments: { method: :put, inputs: form_inputs }) do |item|+ form_arguments: { method: :post, inputs: form_inputs }) do |item|item.with_leading_visual_icon(icon: "chevron-down")endenddiff --git a/config/routes.rb b/config/routes.rbindex 1d76c20d818..81282e04ecf 100644--- a/config/routes.rb+++ b/config/routes.rb@@ -179,7 +179,7 @@ Rails.application.routes.draw doget :deletion_dialogget :new_child, action: :newpost :new_child, action: :create- put :move+ post :moveendendenddiff --git a/spec/controllers/admin/custom_fields/hierarchy/items_controller_spec.rb b/spec/controllers/admin/custom_fields/hierarchy/items_controller_spec.rbindex b2e7e7e2611..d921f70ac02 100644--- a/spec/controllers/admin/custom_fields/hierarchy/items_controller_spec.rb+++ b/spec/controllers/admin/custom_fields/hierarchy/items_controller_spec.rb@@ -147,13 +147,13 @@ RSpec.describe Admin::CustomFields::Hierarchy::ItemsController doendit "redirects to the index" do- put :move, params: { custom_field_id: custom_field.id, id: luke.id, new_sort_order: 3 }+ post :move, params: { custom_field_id: custom_field.id, id: luke.id, new_sort_order: 3 }expect(response).to be_redirectendit "moves the item to the new position" doexpect do- put :move, params: { custom_field_id: custom_field.id, id: luke.id, new_sort_order: 2 }+ post :move, params: { custom_field_id: custom_field.id, id: luke.id, new_sort_order: 2 }end.to change { luke.reload.sort_order }.from(0).to(1)endend