From d931e9f0c7a338e73ee7b5a36cf5b59b10802f09 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Mon, 17 Apr 2023 16:54:01 +0200 Subject: pkg/email/lore: recognize more PATCH subjects --- pkg/email/lore/parse.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'pkg/email/lore/parse.go') diff --git a/pkg/email/lore/parse.go b/pkg/email/lore/parse.go index d9aedf98d..d0e4d4fe2 100644 --- a/pkg/email/lore/parse.go +++ b/pkg/email/lore/parse.go @@ -4,6 +4,7 @@ package lore import ( + "regexp" "sort" "strings" @@ -39,7 +40,7 @@ func DiscussionType(msg *email.Email) dashapi.DiscussionType { discType = dashapi.DiscussionReport } // This is very crude, but should work for now. - if strings.Contains(strings.ToLower(msg.Subject), "[patch") { + if patchSubjectRe.MatchString(strings.ToLower(msg.Subject)) { discType = dashapi.DiscussionPatch } else if strings.Contains(msg.Subject, "Monthly") { discType = dashapi.DiscussionReminder @@ -47,6 +48,8 @@ func DiscussionType(msg *email.Email) dashapi.DiscussionType { return discType } +var patchSubjectRe = regexp.MustCompile(`\[(?:(?:rfc|resend)\s+)*patch`) + type parseCtx struct { threads []*Thread messages map[string]*email.Email -- cgit mrf-deployment