From 8ff94287a739834ee7716cf8677b744f7ea9f60a Mon Sep 17 00:00:00 2001 From: jochen Date: Wed, 21 Oct 2026 00:39:31 +0200 Subject: [PATCH] Show mail that matters, mail groups and scam warnings above the classical list (issue 1430) --- .../cmd/mesh-mail-web/accounts.go | 146 ++++++++++++++++-- .../cmd/mesh-mail-web/mailreading_test.go | 115 ++++++++++++++ .../cmd/mesh-mail-web/manifest_test.go | 7 +- .../mesh-mail-web/cmd/mesh-mail-web/tools.go | 54 ++++++- modules/mesh-mail-web/module.json | 8 +- 5 files changed, 316 insertions(+), 14 deletions(-) create mode 100644 modules/mesh-mail-web/cmd/mesh-mail-web/mailreading_test.go diff --git a/modules/mesh-mail-web/cmd/mesh-mail-web/accounts.go b/modules/mesh-mail-web/cmd/mesh-mail-web/accounts.go index 0ab2cd79..24eb6322 100644 --- a/modules/mesh-mail-web/cmd/mesh-mail-web/accounts.go +++ b/modules/mesh-mail-web/cmd/mesh-mail-web/accounts.go @@ -48,9 +48,55 @@ type accountRow struct { Folders []accountBucketFolder } +// mailEntryRow is one mail entry as the mail-reading section shows it (novox/hq ADR 0459 §13, issue 1430): +// account, message id, date, sender name, subject, group, summary, mark, why and due date — never a body. +// Rendered only through html/template, so nothing a mail carries is ever interpreted as markup (AC1). +type mailEntryRow struct { + SenderName, Summary, Why, DueDate string +} + +// mailGroupRow is one mail group with how many entries hold it (1430/AC1). +type mailGroupRow struct { + Label string + Count int +} + +// mailReadingData is what the accounts page shows above the classical list (1430/AC1-AC3): with +// Unavailable set (mail-reading did not answer status at all, AC3), nothing else here is shown. Otherwise, +// Healthy says whether to show Groups (healthy, AC1) or Cause and Since in their place (unhealthy, AC2); +// Matters and ScamWarnings are shown either way. +type mailReadingData struct { + Unavailable string + Healthy bool + Cause, Since string + Matters []mailEntryRow + Groups []mailGroupRow + ScamWarnings []mailEntryRow +} + var accountsTemplate = template.Must(template.New("accounts").Parse(` Mail accounts

Accounts

+
+{{with .MailReading}} +{{if .Unavailable}}

Mail reading is unavailable: {{.Unavailable}}

+{{else}} +

Mail that matters

+{{if .Matters}} +{{else}}

Nothing matters right now.

{{end}} +{{if .Healthy}} +

Mail groups

+{{if .Groups}}{{else}}

No mail groups yet.

{{end}} +{{else}} +

Mail reading

+

Unhealthy: {{.Cause}} (since {{.Since}})

+{{end}} +

Scam warnings

+{{if .ScamWarnings}} +{{else}}

None.

{{end}} +{{end}} +{{end}} +
{{if .Error}}

{{.Error}}

{{else}}