mirror of
https://github.com/ramvignesh-b/pi-ku.git
synced 2026-05-04 08:56:52 +00:00
refactor: update email notification to account for proper arguments
This commit is contained in:
@@ -35,7 +35,7 @@ def notify_unlocked_letter(letter):
|
|||||||
plaint_content = render_to_string("email/vault_unlock.txt", context=context)
|
plaint_content = render_to_string("email/vault_unlock.txt", context=context)
|
||||||
html_content = render_to_string("email/vault_unlock.html", context=context)
|
html_content = render_to_string("email/vault_unlock.html", context=context)
|
||||||
send_mail(
|
send_mail(
|
||||||
subject,
|
subject=subject,
|
||||||
message=plaint_content,
|
message=plaint_content,
|
||||||
from_email=settings.FROM_EMAIL,
|
from_email=settings.FROM_EMAIL,
|
||||||
recipient_list=[author],
|
recipient_list=[author],
|
||||||
@@ -45,8 +45,8 @@ def notify_unlocked_letter(letter):
|
|||||||
letter.notified_at = datetime.now(UTC)
|
letter.notified_at = datetime.now(UTC)
|
||||||
letter.save()
|
letter.save()
|
||||||
logger.info(f"Successfully notified {author} of unlocked letter")
|
logger.info(f"Successfully notified {author} of unlocked letter")
|
||||||
except Exception as e:
|
except Exception:
|
||||||
logger.exception(f"Failed to notify {author} of unlocked letter", str(e))
|
logger.exception(f"Failed to notify {author} of unlocked letter")
|
||||||
|
|
||||||
|
|
||||||
def vault_unlock_notification_polling_scheduler():
|
def vault_unlock_notification_polling_scheduler():
|
||||||
|
|||||||
@@ -396,6 +396,7 @@ class LetterTaskTest(TestCase):
|
|||||||
from_email=settings.FROM_EMAIL,
|
from_email=settings.FROM_EMAIL,
|
||||||
recipient_list=[self.user.email],
|
recipient_list=[self.user.email],
|
||||||
fail_silently=False,
|
fail_silently=False,
|
||||||
|
html_message=ANY,
|
||||||
)
|
)
|
||||||
self.assertIsNotNone(letter_to_notify1.notified_at)
|
self.assertIsNotNone(letter_to_notify1.notified_at)
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,14 @@ def send_activation_email(user):
|
|||||||
}
|
}
|
||||||
html_content = render_to_string("email/activation.html", context)
|
html_content = render_to_string("email/activation.html", context)
|
||||||
plain_content = render_to_string("email/activation.txt", 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
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user