From 745e45778997cd58e8b6328003c1ed3934aeab84 Mon Sep 17 00:00:00 2001 From: Prospector <6166773+Prospector@users.noreply.github.com> Date: Wed, 21 Oct 2026 14:33:30 -0700 Subject: [PATCH] send email change emails to old email address --- apps/labrinth/src/queue/email.rs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/apps/labrinth/src/queue/email.rs b/apps/labrinth/src/queue/email.rs index 5ee5374b179..e3c914548aa 100644 --- a/apps/labrinth/src/queue/email.rs +++ b/apps/labrinth/src/queue/email.rs @@ -225,10 +225,22 @@ impl EmailQueue { .await .wrap_internal_err("fetching user from database")?; - let Some(mailbox) = maybe_user - .and_then(|user| user.email) - .and_then(|email| email.parse().ok()) - else { + let Some(user) = maybe_user else { + return Ok(( + notification.id, + NotificationDeliveryStatus::SkippedPreferences, + )); + }; + + // user email is new email at this point, pull old email from the notification body + let mailbox = match ¬ification.body { + NotificationBody::EmailChanged { to_email, .. } => { + to_email.parse().ok() + } + _ => user.email.and_then(|email| email.parse().ok()), + }; + + let Some(mailbox) = mailbox else { return Ok(( notification.id, NotificationDeliveryStatus::SkippedPreferences,