Feature/saajan persona (#3)

* feat: add template based email content (html + plaintext fallback)

* feat: init saajan component

* feat: add aesthetic noise background and implement Saajan component in register and login

* feat: add post seal modal for vault

* refactor: add proper props interfaces

* refactor: expose props on ui components

* feat: add ssajan in lots of flows

* fix: remove render test with no value and add aria helper for btn identification

* refactor: update email notification to account for proper arguments

* refactor:  refactor E2E auth helper and mail parsing logic

---------

Co-authored-by: ramvignesh-b <ramvignesh-b@github.com>
This commit is contained in:
RamVignesh B
2026-04-28 20:51:23 +05:30
committed by GitHub
parent 8a9ded42b5
commit 6cf24731ce
36 changed files with 650 additions and 227 deletions
+20 -1
View File
@@ -3,8 +3,10 @@ from datetime import UTC, datetime
import structlog
from apscheduler.schedulers.background import BackgroundScheduler
from django.core.mail import send_mail
from django.template.loader import render_to_string
from config import settings
from config.settings import FRONTEND_URLS
from letters.models import Letter
logger = structlog.get_logger(__name__)
@@ -23,9 +25,26 @@ def notify_unlocked_letter(letter):
"""
author = letter.user.get_username()
try:
send_mail(subject="", message="", from_email=settings.FROM_EMAIL, recipient_list=[author], fail_silently=False)
letter_link = f"{FRONTEND_URLS[0]}/read/{letter.public_id}"
subject = "A letter. Written for this exact moment."
context = {
"pen_name": letter.user.first_name,
"cta": {"title": "View what you wrote", "link": letter_link},
"footnote": True,
}
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,
message=plaint_content,
from_email=settings.FROM_EMAIL,
recipient_list=[author],
fail_silently=False,
html_message=html_content,
)
letter.notified_at = datetime.now(UTC)
letter.save()
logger.info(f"Successfully notified {author} of unlocked letter")
except Exception:
logger.exception(f"Failed to notify {author} of unlocked letter")
+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)