mirror of
https://github.com/mjl-/mox.git
synced 2025-06-27 22:28:16 +03:00

We were already generating previews of plain text parts for the webmail interface, but we didn't store them, so were generating the previews each time messages were listed. Now we store previews in the database for faster handling. And we also generate previews for html parts if needed. We use the first part that has textual content. For IMAP, the previews can be requested by an IMAP client. When we get the "LAZY" variant, which doesn't require us to generate a preview, we generate it anyway, because it should be fast enough. So don't make clients first ask for "PREVIEW (LAZY)" and then again a request for "PREVIEW". We now also generate a preview when a message is added to the account. Except for imports. It would slow us down, the previews aren't urgent, and they will be generated on-demand at first-request.
23 lines
862 B
Go
23 lines
862 B
Go
package webmail
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/mjl-/mox/dns"
|
|
)
|
|
|
|
func TestParseListPostAddress(t *testing.T) {
|
|
check := func(s string, exp *MessageAddress) {
|
|
t.Helper()
|
|
v := parseListPostAddress(s)
|
|
tcompare(t, v, exp)
|
|
}
|
|
|
|
check("<mailto:list@host.com>", &MessageAddress{User: "list", Domain: dns.Domain{ASCII: "host.com"}})
|
|
check("<mailto:moderator@host.com> (Postings are Moderated)", &MessageAddress{User: "moderator", Domain: dns.Domain{ASCII: "host.com"}})
|
|
check("<mailto:moderator@host.com?subject=list%20posting>", &MessageAddress{User: "moderator", Domain: dns.Domain{ASCII: "host.com"}})
|
|
check("NO (posting not allowed on this list)", nil)
|
|
check("<https://groups.google.com/group/golang-dev/post>, <mailto:golang-dev@googlegroups.com>", &MessageAddress{User: "golang-dev", Domain: dns.Domain{ASCII: "googlegroups.com"}})
|
|
check("", nil)
|
|
}
|