feat(notify): name regions and link the console in alerts; consent to subscribe
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 11m8s
ci / test (pull_request) Successful in 13m45s
ci / build (pull_request) Successful in 19m0s
ci / image (pull_request) Successful in 6m5s

Alert mails and chat messages named regions by id. They now show the
region's name and mails link the monitor in the console.

Visitors of a status page accept the platform's terms and the page's
privacy policy, where set, before they can subscribe to it; the status
page server and the API both check it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-11-26 20:16:28 +01:00
1 parent cca4e80e54
commit 2d4bd10c9b
16 files changed
+660 -479

No files matched your search

+26 -2
View File
@@ -2,6 +2,7 @@ package web
import (
"bytes"
"slices"
"github.com/yuin/goldmark"
"github.com/yuin/goldmark/ast"
@@ -80,7 +81,30 @@ func LegalLinks(docs []agentapi.LegalDoc, base string) []LegalLink {
return out
}
// PageLegalLinks returns the legal links of a status page.
// PageLegalLinks returns the legal links of a status page's footer. The
// terms are not among them: visitors accept them only when subscribing.
func PageLegalLinks(s agentapi.PageSnapshot, base string) []LegalLink {
return LegalLinks(s.Legal, base)
return slices.DeleteFunc(LegalLinks(s.Legal, base), func(l LegalLink) bool { return l.Kind == "terms" })
}
// SubscribeConsent returns the documents a visitor of a status page
// accepts by subscribing: the terms and the privacy policy, where set.
func SubscribeConsent(s agentapi.PageSnapshot, base string) []LegalLink {
return slices.DeleteFunc(LegalLinks(s.Legal, base), func(l LegalLink) bool { return l.Kind == "imprint" })
}
// ConsentLabelID names the message of the subscription checkbox for links.
func ConsentLabelID(links []LegalLink) string {
var terms, privacy bool
for _, l := range links {
terms = terms || l.Kind == "terms"
privacy = privacy || l.Kind == "privacy"
}
switch {
case terms && privacy:
return "page.subscribe.accept_both"
case terms:
return "page.subscribe.accept_terms"
}
return "page.subscribe.accept_privacy"
}