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:
jay
2026-06-09 16:35:05 -04:00
parent cf5cbb33c0
commit 1956d7fd23
6 changed files with 42 additions and 12 deletions
+10 -2
View File
@@ -305,14 +305,22 @@
// The finite-ending's gentle nudge: one tap to get tomorrow's brief by email.
let digestBusy = $state(false);
let pendingDigestOptIn = $state(false);
async function subscribeDigest() {
if (!auth.user) { showSignIn = true; return; } // sign in, then enable below
if (!auth.user) { pendingDigestOptIn = true; showSignIn = true; return; } // sign in → auto-enable
if (auth.user.digest_enabled || digestBusy) return;
digestBusy = true;
try { await postJSON('/api/account/digest', { enabled: true }); await refreshAuth(); }
catch { /* leave as-is */ }
finally { digestBusy = false; }
}
// Keep the one-tap promise: if they tapped while signed out, enable right after sign-in.
$effect(() => {
if (pendingDigestOptIn && auth.user) {
pendingDigestOptIn = false;
if (!auth.user.digest_enabled) subscribeDigest();
}
});
const MIX_EVENT = { notToday: 'not_today', lessLikeThis: 'less_like_this', alwaysHide: 'hide_topic' };
function applyAction(kind, value) {
@@ -443,7 +451,7 @@
</section>
<div class="endcap rise">
<p class="endmark">✦ that's the good news for today ✦</p>
<p class="endsub">You're caught up — see you tomorrow.</p>
<p class="endsub">You're caught up for now.</p>
{#if auth.user?.digest_enabled}
<p class="digestnote">Tomorrow's brief is headed to your inbox ☕</p>
{:else}