Simplify email subject handling and remove duplicate functions
Mirror and run GitLab CI / build (push) Has been cancelled
Ruff / ruff (push) Has been cancelled

- Remove send_success_email/send_error_email from email_sender.py
- Centralize subject logic in tasks.py using _get_subject()
- Use EMAIL_SUBJECT_SUCCESS and EMAIL_SUBJECT_ERROR with clear defaults
- Ensure subject is always set and logged before sending
This commit is contained in:
admin
2026-06-15 03:52:19 +00:00
parent e27e5b8522
commit b0a1bc059b
2 changed files with 4 additions and 125 deletions
+4 -16
View File
@@ -164,22 +164,10 @@ def send_success_email(
Subject is customizable via EMAIL_SUBJECT_SUCCESS.
Falls back to a safe default if the env var is missing or blank.
"""
# Read subject from environment; never allow blank
raw_subject = os.getenv("EMAIL_SUBJECT_SUCCESS")
subject = (raw_subject or "").strip()
if not subject:
subject = "ScrAIbe: Your transcript is ready"
logger.info(
"EMAIL_SUBJECT_SUCCESS not set or blank; using default subject: %s", subject
)
else:
logger.info("Using EMAIL_SUBJECT_SUCCESS: %s", subject)
# Final guard: ensure subject is never empty
if not subject:
subject = "ScrAIbe: Your transcript is ready"
logger.warning("Subject was empty after reading; forced default subject.")
subject = _get_subject(
"EMAIL_SUBJECT_SUCCESS",
"ScrAIbe: Your transcript is ready",
)
body = (
"Hello,\n\n"