feat: announcement email with one-click unsubscribe headers

This commit is contained in:
2026-09-11 13:34:14 +00:00
parent a901482e5d
commit f65174a368
7 changed files with 180 additions and 12 deletions
+16 -12
View File
@@ -20,18 +20,18 @@ func cases() map[string]any {
"invite": s.inviteData("sam@example.com", "Northwind Ops", "8a1b2c3d4e"),
"license": licenseData("northwind-prod",
"eyJ2IjoxLCJpbnN0YW5jZSI6Im5vcnRod2luZC1wcm9kIiwidGllciI6ImZyZWUiLCJleHAiOjE3OTk5OTk5OTl9.MEUCIQDk3v1rX0sX7kQ2m9WQ1o0q8pWm6lq3vRjz8yN0yX4bGQIgYk2Fh7s"),
"instanceready": instanceReadyData("northwind-prod", "https://northwind-prod.vantage.hostxtra.co.uk", now.Add(30*day)),
"instanceready/nologin": instanceReadyData("northwind-prod", "", now.Add(30*day)),
"renewed": renewedData("northwind-prod", now.Add(30*day)),
"expiring": expiringData("northwind-prod", s.PublicURL, now.Add(7*day)),
"expired": expiredData("northwind-prod", s.PublicURL, now.Add(14*day)),
"expired/noreaper": expiredData("northwind-prod", s.PublicURL, time.Time{}),
"deletionwarning": deletionWarningData("northwind-prod", s.PublicURL, now.Add(7*day), 7),
"deletionwarning/1day": deletionWarningData("northwind-prod", s.PublicURL, now.Add(day), 1),
"cancelled": s.billingData("northwind-prod"),
"pastdue": s.billingData("northwind-prod"),
"monitoralert": MonitorEvent{MonitorName: "api.northwind.io", Type: "http", OldStatus: "up", NewStatus: "down", Message: "GET /healthz returned 503 Service Unavailable after 2.4s", Time: now, Down: true},
"monitoralert/recovered": MonitorEvent{MonitorName: "api.northwind.io", Type: "http", OldStatus: "down", NewStatus: "up", Message: "200 OK in 182ms", Time: now},
"instanceready": instanceReadyData("northwind-prod", "https://northwind-prod.vantage.hostxtra.co.uk", now.Add(30*day)),
"instanceready/nologin": instanceReadyData("northwind-prod", "", now.Add(30*day)),
"renewed": renewedData("northwind-prod", now.Add(30*day)),
"expiring": expiringData("northwind-prod", s.PublicURL, now.Add(7*day)),
"expired": expiredData("northwind-prod", s.PublicURL, now.Add(14*day)),
"expired/noreaper": expiredData("northwind-prod", s.PublicURL, time.Time{}),
"deletionwarning": deletionWarningData("northwind-prod", s.PublicURL, now.Add(7*day), 7),
"deletionwarning/1day": deletionWarningData("northwind-prod", s.PublicURL, now.Add(day), 1),
"cancelled": s.billingData("northwind-prod"),
"pastdue": s.billingData("northwind-prod"),
"monitoralert": MonitorEvent{MonitorName: "api.northwind.io", Type: "http", OldStatus: "up", NewStatus: "down", Message: "GET /healthz returned 503 Service Unavailable after 2.4s", Time: now, Down: true},
"monitoralert/recovered": MonitorEvent{MonitorName: "api.northwind.io", Type: "http", OldStatus: "down", NewStatus: "up", Message: "200 OK in 182ms", Time: now},
"contact": struct {
Enquiry
Received string
@@ -47,6 +47,10 @@ func cases() map[string]any {
{CVEID: "CVE-2025-48112", Severity: "low", PackageName: "less", ServerName: "worker-03"},
},
More: 9, DBAge: "2 days"},
"announcement": announcementData{
Announcement: sampleAnnouncement(),
BodyHTML: "<p>Workflows can now run <strong>on a schedule</strong>.</p>",
},
"accountlocked": sampleNotice(),
"disputereminder": sampleNotice(),
"accountterminated": sampleNotice(),