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

♾️ Fix handling meeting series that end_after never

Alexander Brandon Coles7f7af8f4492f
diff --git a/modules/meeting/app/components/recurring_meetings/delete_dialog_component.rb b/modules/meeting/app/components/recurring_meetings/delete_dialog_component.rb
index 72368d123c1..6abf3e86201 100644
--- a/modules/meeting/app/components/recurring_meetings/delete_dialog_component.rb
+++ b/modules/meeting/app/components/recurring_meetings/delete_dialog_component.rb
@@ -49,7 +49,7 @@ module RecurringMeetings
def confirmation_message
t("recurring_meeting.delete_dialog.confirmation_message_html",
title: @recurring_meeting.title,
- count: @recurring_meeting.remaining_occurrences.count)
+ count: @recurring_meeting.remaining_occurrences&.count || 0) # actually ♾️, but we show same message as for 0
end
end
end
diff --git a/modules/meeting/config/locales/en.yml b/modules/meeting/config/locales/en.yml
index e8efab0c491..31fe68ead9f 100644
--- a/modules/meeting/config/locales/en.yml
+++ b/modules/meeting/config/locales/en.yml
@@ -290,10 +290,17 @@ en:
delete_dialog:
title: "Delete meeting series"
heading: "Permanently delete this meeting series?"
- confirmation_message_html: >
- Deleting <strong>%{title}</strong> will delete all %{count} meetings in this series.
+ confirmation_message_html:
+ zero: >
+ Deleting <strong>%{title}</strong> will delete any meetings in this series.
+ This action is not reversible. Please proceed with caution.
+ one: >
+ Deleting <strong>%{title}</strong> will also delete one meeting in this series.
+ This action is not reversible. Please proceed with caution.
+ other: >
+ Deleting <strong>%{title}</strong> will delete all %{count} meetings in this series.
+ This action is not reversible. Please proceed with caution.
- This action is not reversible. Please proceed with caution.
scheduled_delete_dialog:
title: "Cancel meeting occurrence"
heading: "Cancel this meeting occurrence?"
diff --git a/modules/meeting/spec/components/recurring_meetings/delete_dialog_component_spec.rb b/modules/meeting/spec/components/recurring_meetings/delete_dialog_component_spec.rb
index 4996ce890b7..6e7e94feebe 100644
--- a/modules/meeting/spec/components/recurring_meetings/delete_dialog_component_spec.rb
+++ b/modules/meeting/spec/components/recurring_meetings/delete_dialog_component_spec.rb
@@ -69,7 +69,25 @@ RSpec.describe RecurringMeetings::DeleteDialogComponent, type: :component do
expect(subject).to have_text "Permanently delete this meeting series?"
end
- it "shows a confirmation message detailing the remaining occurrences in the series" do
- expect(subject).to have_text "will delete all 6 meetings in this series"
+ context "with a meeting series that ends - with several remaining meetings" do
+ it "shows a confirmation message with a count of the remaining meetings" do
+ expect(subject).to have_text "will delete all 6 meetings in this series"
+ end
+ end
+
+ context "with a meeting series that ends - with one remaining meeting" do
+ let(:recurring_meeting) { build_stubbed(:recurring_meeting, project:, end_after: :iterations, iterations: 1) }
+
+ it "shows a confirmation message mentioning one remaining meeting" do
+ expect(subject).to have_text "will also delete one meeting in this series"
+ end
+ end
+
+ context "with a meeting series that never ends" do
+ let(:recurring_meeting) { build_stubbed(:recurring_meeting, project:, end_after: :never) }
+
+ it "shows a confirmation message without a count" do
+ expect(subject).to have_text "will delete any meetings in this series"
+ end
end
end