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}}