Digest polish: honest on-site wording, one-tap opt-in after sign-in, List-Unsubscribe
* On-site end-cap now says "You're caught up for now." — honest, since Highlights refreshes through the day (the email keeps the daily "see you tomorrow"). * Anonymous "Get tomorrow's brief by email" now honors the one-tap promise: sets a pending flag, opens sign-in, and auto-enables once auth resolves. * Email compliance (RFC 2369/8058): send_email takes optional headers; the digest sets List-Unsubscribe + List-Unsubscribe-Post=One-Click, and a POST /api/digest/unsubscribe handles native one-click (GET still serves the page). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+5
-2
@@ -148,9 +148,12 @@ def send_due_digests(conn: sqlite3.Connection, force: bool = False, base: str |
|
||||
conn.execute("UPDATE users SET digest_unsub_token = ? WHERE id = ?", (token, user["id"]))
|
||||
conn.commit()
|
||||
user["digest_unsub_token"] = token
|
||||
subject, text, html = build_digest(items, brief_date, unsub_url(user, base), base)
|
||||
link = unsub_url(user, base)
|
||||
subject, text, html = build_digest(items, brief_date, link, base)
|
||||
# RFC 2369 / 8058: let inboxes offer native one-click unsubscribe.
|
||||
headers = {"List-Unsubscribe": f"<{link}>", "List-Unsubscribe-Post": "List-Unsubscribe=One-Click"}
|
||||
try:
|
||||
email_send.send_email(user["email"], subject, text, html=html)
|
||||
email_send.send_email(user["email"], subject, text, html=html, headers=headers)
|
||||
except Exception: # noqa: BLE001 — one bad send shouldn't stop the rest; retry next window
|
||||
continue
|
||||
conn.execute(
|
||||
|
||||
Reference in New Issue
Block a user