[PM-36011] feat: add member email change notification email#8044
Conversation
4b4a236 to
1899f50
Compare
b118fb3 to
9ccf265
Compare
1899f50 to
0f7dbea
Compare
ed975cf to
66f8162
Compare
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE Reviewed the new "member email changed" notification email: the view/mail model, MJML source and compiled Handlebars templates, the render test, and the wiring into Code Review Details
|
| await changeEmailCommand.ChangeEmailAsync(request.UserToUpdate, request.NewEmail!); | ||
|
|
||
| await SendEmailChangedNotificationAsync(previousEmail, request.NewEmail!); |
There was a problem hiding this comment.
Details and fix
SendEmailChangedNotificationAsync runs inside TryApplyAccountChangesAsync, whose only catch is BadRequestException (mapped by MapEmailChangeError). Mail delivery services (SendGridMailDeliveryService, AmazonSesMailDeliveryService, MailKitSmtpMailDeliveryService) throw HTTP/SMTP/network exceptions, not BadRequestException.
Because ChangeEmailAsync has already persisted the account change and synced Stripe (per the comment on line 115), a transient send failure would throw an unhandled exception out of UpdateUserAsync and surface to the admin as a failed update — even though the email change actually succeeded. The notification is a best-effort side effect and should not be able to fail the primary operation.
The sibling OrganizationAutoConfirmEnabledNotificationCommand already guards its mailer.SendEmail call in a try/catch that logs and continues. Consider the same here, e.g.:
try
{
await SendEmailChangedNotificationAsync(previousEmail, request.NewEmail!);
}
catch (Exception ex)
{
logger.LogError(ex, "Failed to send member email-change notification for organization user {OrganizationUserId}.", request.OrganizationUserToUpdate.Id);
}(logging without the recipient address to avoid PII in logs).
| await changeEmailCommand.ChangeEmailAsync(request.UserToUpdate, request.NewEmail!); | ||
|
|
||
| await SendEmailChangedNotificationAsync(previousEmail, request.NewEmail!); |
66f8162 to
c76d02c
Compare
| catch (Exception ex) | ||
| { | ||
| logger.LogError(ex, "Failed to send member email-change notification for organization user {OrganizationUserId}.", request.OrganizationUserToUpdate.Id); | ||
| } |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## jmccannon/ac/pm-38926-admin-change-email #8044 +/- ##
=========================================================================
Coverage 62.61% 62.62%
=========================================================================
Files 2305 2306 +1
Lines 100355 100371 +16
Branches 9046 9046
=========================================================================
+ Hits 62839 62854 +15
- Misses 35337 35338 +1
Partials 2179 2179 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
PM-36011
📔 Objective
Adds the "Your Bitwarden account email was updated" notification email (part of PM-28365), built with the IMailer / MJML pipeline: view model, mail class, MJML source, compiled templates, and a render test.
Screenshot