email: split digest renderer to digest_email.py
email_service.py was 428 lines covering three different concerns: SMTP transport, OTP/welcome rendering (tightly coupled — same brand template + theme), and digest rendering (a totally different shape of email, different layout, different copy cadence). The two halves changed at different cadences and made the file noisy to navigate. Extracted render_digest_email + _DIGEST_HTML_TEMPLATE + _strip_html_to_text to app/services/digest_email.py. SMTP transport and the OTP/welcome surface stay in email_service.py. Import sites updated: email_digest_job and test_email_render now import render_digest_email from digest_email. The OTP/welcome import sites (auth router, branding tests, test_email_service) are untouched. No behaviour change — pure relocation. Templates byte-identical. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
4adc8dfe82
commit
b055eea1c2
4 changed files with 119 additions and 107 deletions
|
|
@ -29,7 +29,8 @@ from app.jobs._market_context import (
|
|||
from app.models import EmailSend, User
|
||||
from app.routers.email import sign_unsubscribe_token
|
||||
from app.services.access import paid_status
|
||||
from app.services.email_service import render_digest_email, send_email
|
||||
from app.services.digest_email import render_digest_email
|
||||
from app.services.email_service import send_email
|
||||
from app.services.i18n import ACTIVE_LANGUAGES
|
||||
from app.services.llm_prompts import (
|
||||
PROMPT_VERSION,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue