Forum: e-mail notifications with a daily digest

Members choose per kind: replies to them (daily digest, instant or off),
new posts in followed threads (daily or off), private messages and
requests (instant or off). The forum service queues the instant e-mails
(none while online, at most one per thread an hour); the worker's new
forum task makes the evening digest of what is unread. Every forum e-mail
greets by the nickname and has a one-click unsubscribe (RFC 8058).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
feco
2026-11-26 10:59:29 +00:00
co-authored by Claude Opus 5.5
parent 4def9569b1
commit 7c768fccff
22 changed files with 938 additions and 27 deletions
+11
View File
@@ -19,6 +19,7 @@ mod cleanup;
mod compare;
mod config;
mod email;
mod forum_digest;
mod invoices;
mod notify;
mod ses;
@@ -105,6 +106,7 @@ async fn main() -> anyhow::Result<()> {
analyses = tasks.analyses,
invoices = tasks.invoices,
notify = tasks.notify,
forum = tasks.forum,
"worker tasks"
);
match &config.smtp_url {
@@ -167,6 +169,15 @@ async fn main() -> anyhow::Result<()> {
_ => tracing::info!("TELEGRAM_BOT_TOKEN or TELEGRAM_CHAT_ID is not set: no purchase notices"),
}
match &config.public_base_url {
_ if !tasks.forum => {}
Some(base) => {
tracing::info!("forum digests enabled");
jobs.spawn(forum_digest::run(pool.clone(), base.clone(), stop.clone()));
}
None => tracing::warn!("PUBLIC_BASE_URL is not set: no forum digests (their links need it)"),
}
let app = Router::new().route("/healthz", get(healthz)).with_state(pool);
let listener = tokio::net::TcpListener::bind(addr).await.with_context(|| format!("binding {addr}"))?;
tracing::info!(%addr, "worker running");