refactor: update email notification to account for proper arguments

This commit is contained in:
ramvignesh-b
2026-04-28 18:42:00 +05:30
parent 412abd912c
commit df73fb6b6a
3 changed files with 12 additions and 4 deletions
+3 -3
View File
@@ -35,7 +35,7 @@ def notify_unlocked_letter(letter):
plaint_content = render_to_string("email/vault_unlock.txt", context=context)
html_content = render_to_string("email/vault_unlock.html", context=context)
send_mail(
subject,
subject=subject,
message=plaint_content,
from_email=settings.FROM_EMAIL,
recipient_list=[author],
@@ -45,8 +45,8 @@ def notify_unlocked_letter(letter):
letter.notified_at = datetime.now(UTC)
letter.save()
logger.info(f"Successfully notified {author} of unlocked letter")
except Exception as e:
logger.exception(f"Failed to notify {author} of unlocked letter", str(e))
except Exception:
logger.exception(f"Failed to notify {author} of unlocked letter")
def vault_unlock_notification_polling_scheduler():
+1
View File
@@ -396,6 +396,7 @@ class LetterTaskTest(TestCase):
from_email=settings.FROM_EMAIL,
recipient_list=[self.user.email],
fail_silently=False,
html_message=ANY,
)
self.assertIsNotNone(letter_to_notify1.notified_at)
+8 -1
View File
@@ -21,7 +21,14 @@ def send_activation_email(user):
}
html_content = render_to_string("email/activation.html", context)
plain_content = render_to_string("email/activation.txt", context)
send_mail(subject, plain_content, settings.FROM_EMAIL, [user.email], fail_silently=False, html_message=html_content)
send_mail(
subject=subject,
message=plain_content,
from_email=settings.FROM_EMAIL,
recipient_list=[user.email],
fail_silently=False,
html_message=html_content,
)
return True