fix: deliver monthly attendance reminder emails#2622
Merged
mroderick merged 1 commit intoMay 26, 2026
Conversation
send_monthly_attendance_reminder_emails has been broken since the feature was introduced in 2016. It instantiates a mailer message but never calls deliver_now or deliver_later, so the message is discarded without ever being sent. Since the method is already wrapped in handle_asynchronously, the correct fix is deliver_now (send synchronously within the already-async job). Also converts the existing :wip test from a mock-based assertion to a delivery assertion, verifying that emails are actually sent. Fixes discussion codebar#2593
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
send_monthly_attendance_reminder_emailshas been broken since the feature was introduced in 2016. It instantiates a mailer message but never calls.deliver_nowor.deliver_later, so the message is created in memory and immediately discarded.The Bug
Since the method is already wrapped in
handle_asynchronously, the correct fix is.deliver_now(send synchronously within the already-async job). Using.deliver_laterwould double-queue emails.History
See discussion #2593 for the full analysis. In short:
.deliver_nowChanges
app/models/invitation_manager.rb: add.deliver_nowto the mailer callspec/models/invitation_manager_spec.rb: convert:wipmock-based test to a delivery assertionTesting
All 39 examples in
spec/models/invitation_manager_spec.rbpass, including the newly-converted delivery assertion. The rake task spec also passes.Risk
Very low. This only affects upcoming monthly meetings. There is no backlog of unsent emails (the mailer objects were never persisted). Fixing this will simply cause future monthly attendance reminders to actually be delivered.