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 project-scoped delete dialogs invoked from row
Alexander Brandon Colesdfc8c8eda247
diff --git a/modules/meeting/app/components/meetings/row_component.rb b/modules/meeting/app/components/meetings/row_component.rbindex ea4ac880968..61c25accba8 100644--- a/modules/meeting/app/components/meetings/row_component.rb+++ b/modules/meeting/app/components/meetings/row_component.rb@@ -30,6 +30,8 @@module Meetingsclass RowComponent < ::OpPrimer::BorderBoxRowComponent+ delegate :current_project, to: :table+def project_namehelpers.link_to_project model.project, {}, {}, falseend@@ -140,7 +142,7 @@ module Meetingsmenu.with_item(label: recurring_meeting.present? ? I18n.t(:label_recurring_meeting_delete) : I18n.t(:label_meeting_delete),scheme: :danger,- href: delete_dialog_meeting_path(model),+ href: polymorphic_path([:delete_dialog, current_project, model.becomes(Meeting)]),tag: :a,content_arguments: {data: { controller: "async-dialog" }diff --git a/modules/meeting/spec/components/meetings/row_component_spec.rb b/modules/meeting/spec/components/meetings/row_component_spec.rbindex ead083d0fbe..191d142180a 100644--- a/modules/meeting/spec/components/meetings/row_component_spec.rb+++ b/modules/meeting/spec/components/meetings/row_component_spec.rb@@ -33,8 +33,11 @@ require "rails_helper"RSpec.describe Meetings::RowComponent, type: :component doinclude Rails.application.routes.url_helpers- let(:table) { instance_double(Meetings::TableComponent, columns: [], grid_class: "test", has_actions?: true) }let(:project) { build_stubbed(:project) }+ let(:table) do+ instance_double(Meetings::TableComponent, columns: [], grid_class: "test", has_actions?: true, current_project:)+ end+ let(:current_project) { nil }let(:user) { build_stubbed(:user) }subject do@@ -77,8 +80,18 @@ RSpec.describe Meetings::RowComponent, type: :component docontext "with a one-off meeting" dolet(:meeting) { build_stubbed(:meeting, project:) }- it "shows delete menu item" do- expect(subject).to have_link "Delete meeting", href: delete_dialog_meeting_path(meeting)+ context "without a current project" do+ it "shows delete menu item" do+ expect(subject).to have_link "Delete meeting", href: delete_dialog_meeting_path(meeting)+ end+ end++ context "with a current project" do+ let(:current_project) { project }++ it "shows delete menu item" do+ expect(subject).to have_link "Delete meeting", href: delete_dialog_project_meeting_path(project, meeting)+ endendend@@ -86,8 +99,18 @@ RSpec.describe Meetings::RowComponent, type: :component dolet(:series) { build_stubbed(:recurring_meeting, project:) }let(:meeting) { build_stubbed(:structured_meeting_template, recurring_meeting: series, project:) }- it "shows delete menu item" do- expect(subject).to have_link "Delete occurrence", href: delete_dialog_meeting_path(meeting)+ context "without a current project" do+ it "shows delete menu item" do+ expect(subject).to have_link "Delete occurrence", href: delete_dialog_meeting_path(meeting)+ end+ end++ context "with a current project" do+ let(:current_project) { project }++ it "shows delete menu item" do+ expect(subject).to have_link "Delete occurrence", href: delete_dialog_project_meeting_path(project, meeting)+ endendendend