aboutsummaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/email/lore/parse.go5
-rw-r--r--pkg/email/lore/parse_test.go12
2 files changed, 16 insertions, 1 deletions
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
diff --git a/pkg/email/lore/parse_test.go b/pkg/email/lore/parse_test.go
index a138139b5..84d3d0bdf 100644
--- a/pkg/email/lore/parse_test.go
+++ b/pkg/email/lore/parse_test.go
@@ -269,6 +269,18 @@ func TestDiscussionType(t *testing.T) {
},
{
msg: &email.Email{
+ Subject: "[RFC PATCH] Bla-bla",
+ },
+ ret: dashapi.DiscussionPatch,
+ },
+ {
+ msg: &email.Email{
+ Subject: "[RESEND PATCH] Bla-bla",
+ },
+ ret: dashapi.DiscussionPatch,
+ },
+ {
+ msg: &email.Email{
Subject: "[syzbot] Monthly ext4 report",
OwnEmail: true,
},