handling of failed email sends to domain managers

This commit is contained in:
David Kennedy 2025-01-29 15:02:46 -05:00
parent bc7bc4d6e1
commit 6634e9bad8
No known key found for this signature in database
GPG key ID: 6528A5386E66B96B
5 changed files with 36 additions and 22 deletions

View file

@ -1410,7 +1410,7 @@ class BaseInvitationAdmin(ListHeaderAdmin):
# store current messages from request so that they are preserved throughout the method
storage = get_messages(request)
# Check if there are any error or warning messages in the `messages` framework
has_errors = any(message.level_tag in ["error", "warning"] for message in storage)
has_errors = any(message.level_tag in ["error"] for message in storage)
if has_errors:
# Re-render the change form if there are errors or warnings
@ -1552,13 +1552,14 @@ class DomainInvitationAdmin(BaseInvitationAdmin):
portfolio_invitation.save()
messages.success(request, f"{requested_email} has been invited to the organization: {domain_org}")
send_domain_invitation_email(
if not send_domain_invitation_email(
email=requested_email,
requestor=requestor,
domains=domain,
is_member_of_different_org=member_of_a_different_org,
requested_user=requested_user,
)
):
messages.warning(request, "Could not send email confirmation to existing domain managers.")
if requested_user is not None:
# Domain Invitation creation for an existing User
obj.retrieve()