Merge pull request #21544 from opf/bug/70178-missing-notification-when-enabling-email-notifications-for-a-series

[#70178] Missing notification when enabling email notifications for a series
This commit is contained in:
Mir Bhatia
2026-01-07 14:00:34 +01:00
committed by GitHub
2 changed files with 70 additions and 1 deletions
@@ -335,8 +335,15 @@ class MeetingsController < ApplicationController
def toggle_notifications
@meeting.toggle!(:notify)
# Reload to get the updated value
@meeting.recurring_meeting.template.reload if @meeting.template?
if @meeting.notify?
handle_notification(type: :toggle_notifications)
if @meeting.template?
handle_series_notification
else
handle_notification(type: :toggle_notifications)
end
end
update_sidebar_component_via_turbo_stream
@@ -588,4 +595,21 @@ class MeetingsController < ApplicationController
render_error_flash_message_via_turbo_stream(message:)
end
end
def handle_series_notification
recurring_meeting = @meeting.recurring_meeting
@meeting
.participants
.invited
.find_each do |participant|
MeetingSeriesMailer.invited(
recurring_meeting,
participant.user,
User.current
).deliver_later
end
render_success_flash_message_via_turbo_stream(message: I18n.t(:notice_successful_notification))
end
end
@@ -372,6 +372,51 @@ RSpec.describe "Meeting notifications", :js do
perform_enqueued_jobs
expect(ActionMailer::Base.deliveries.size).to eq 0
end
it "sends out an invite notification when enabling notifications on a series template (Bug #70178)" do
template_page.visit!
template_page.open_first_meeting
wait_for_network_idle
# check for initial invitation mail
perform_enqueued_jobs
expect(ActionMailer::Base.deliveries.size).to eq 1
ActionMailer::Base.deliveries.clear
template_page.visit!
expect(meeting.template.reload.notify).to be true
page.within("[data-test-selector='email-updates-mode-selector']") do
click_on "Disable"
end
template_page.expect_modal "Disable email calendar updates?"
template_page.within_modal "Disable email calendar updates?" do
click_on "Disable email updates"
end
wait_for_network_idle
expect(meeting.template.reload.notify).to be false
page.within("[data-test-selector='email-updates-mode-selector']") do
click_on "Enable"
end
template_page.expect_modal "Enable email calendar updates?"
template_page.within_modal "Enable email calendar updates?" do
click_on "Enable email updates"
end
wait_for_network_idle
expect_flash(message: "Email calendar update sent to all participants")
expect(meeting.template.reload.notify).to be true
# check for invitation mail on re-enabling notifications
perform_enqueued_jobs
expect(ActionMailer::Base.deliveries.size).to eq 1
end
end
context "when a meeting is closed" do