Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion modules/meeting/app/controllers/meetings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,15 @@ def toggle_notifications_dialog
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
Expand Down Expand Up @@ -588,4 +595,21 @@ def handle_notification(type:)
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
45 changes: 45 additions & 0 deletions modules/meeting/spec/features/meeting_notifications_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,51 @@
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
Expand Down
Loading