Skip to content

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

[#67159] Fix Delete action in Projects List menu

Alexander Brandon Coles4be9c2d4181c
diff --git a/app/components/projects/row_component.rb b/app/components/projects/row_component.rb
index d5b48d232fb..89b88b3587d 100644
--- a/app/components/projects/row_component.rb
+++ b/app/components/projects/row_component.rb
@@ -375,7 +375,7 @@ module Projects
icon: :trash,
label: I18n.t(:button_delete),
href: confirm_destroy_project_path(project),
- data: { turbo: false }
+ data: { turbo_stream: true }
}
end
end
diff --git a/spec/components/projects/row_component_spec.rb b/spec/components/projects/row_component_spec.rb
index 70c6c1dc071..9c2a63e420d 100644
--- a/spec/components/projects/row_component_spec.rb
+++ b/spec/components/projects/row_component_spec.rb
@@ -92,6 +92,7 @@ RSpec.describe Projects::RowComponent, type: :component do
expect(menu).to have_selector :menuitem, text: "Copy"
expect(menu).to have_selector :menuitem, text: "Delete" do |link|
expect(link[:href]).to eq confirm_destroy_project_path(project)
+ expect(link[:"data-turbo-stream"]).to eq "true"
end
end
end
diff --git a/spec/features/projects/lists/table_spec.rb b/spec/features/projects/lists/table_spec.rb
index 640eddbee7d..b28e6ca9a20 100644
--- a/spec/features/projects/lists/table_spec.rb
+++ b/spec/features/projects/lists/table_spec.rb
@@ -272,6 +272,26 @@ RSpec.describe "Projects lists table display and actions", :js, with_settings: {
expect(project).not_to be_favored_by(admin)
end
+ specify "project can be deleted" do
+ login_as(admin)
+ visit projects_path
+
+ projects_page.activate_menu_of(project) do |menu|
+ expect(menu).to have_text("Delete")
+ click_link_or_button "Delete"
+ end
+
+ expect(page).to have_modal "Delete project"
+
+ within_modal "Delete project" do
+ expect(page).to have_heading "Permanently delete this project?"
+
+ # We test the actual deletion in spec/features/projects/destroy_spec.rb
+ click_on "Cancel"
+ end
+ expect(page).to have_no_modal "Delete project"
+ end
+
specify "flash sortBy is being escaped" do
login_as(admin)
visit projects_path(sortBy: "[[\"><script src='/foobar.js'></script>\",\"\"]]")