Loading
Skip note emails when the recipient was deleted before sending
What does this MR do and why?
Emails::Notes#setup_note_mail loaded the recipient with User.find. If the recipient is deleted after a Notify#note_*_email job is queued but before it runs, the job raises ActiveRecord::RecordNotFound, is retried by ActionMailer::MailDeliveryJob, and ends up in the dead set even though it can never succeed.
This follows up !267804 (merged), which fixed the same failure mode for deleted notes: the recipient is now looked up with User.find_by_id, and setup_note_mail returns false when it is missing, so every note email action returns before calling mail and no SentNotification is recorded.
Closes #638487 (closed)
How to set up and validate locally
bin/rspec spec/mailers/notify_spec.rb -e 'when the recipient is deleted before the email is sent'MR acceptance checklist
Evaluate this MR against the MR acceptance checklist.