aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/email
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2023-04-12 11:49:19 +0200
committerAleksandr Nogikh <wp32pw@gmail.com>2023-04-12 13:55:59 +0200
commit4fbf89114af1e1cc49ed525f0b28c49411115631 (patch)
treead0c8b3bb2986c571f09625d11fb20ae3f19eb38 /pkg/email
parent7d51c8e0e6ed30cf613d9c45368504d147cdfc53 (diff)
dashboard: separate DiscussionReport and DiscussionMention
DiscussionReport are the discussions started by syzbot. All other discussions that Cc syzbot or mention its bugs are DiscussionMention.
Diffstat (limited to 'pkg/email')
-rw-r--r--pkg/email/lore/parse.go5
-rw-r--r--pkg/email/lore/parse_test.go22
2 files changed, 19 insertions, 8 deletions
diff --git a/pkg/email/lore/parse.go b/pkg/email/lore/parse.go
index d2dc9c04b..42a0d9007 100644
--- a/pkg/email/lore/parse.go
+++ b/pkg/email/lore/parse.go
@@ -34,7 +34,10 @@ func Threads(emails []*email.Email) []*Thread {
// DiscussionType extracts the specific discussion type from an email.
func DiscussionType(msg *email.Email) dashapi.DiscussionType {
- discType := dashapi.DiscussionReport
+ discType := dashapi.DiscussionMention
+ if msg.OwnEmail {
+ discType = dashapi.DiscussionReport
+ }
// This is very crude, but should work for now.
if strings.Contains(msg.Subject, "PATCH") {
discType = dashapi.DiscussionPatch
diff --git a/pkg/email/lore/parse_test.go b/pkg/email/lore/parse_test.go
index 2343a7c26..b521d694f 100644
--- a/pkg/email/lore/parse_test.go
+++ b/pkg/email/lore/parse_test.go
@@ -86,7 +86,7 @@ Content-Type: text/plain
Patch`,
// An orphaned reply from a human.
`Date: Sun, 7 May 2017 19:57:00 -0700
-Subject: [syzbot] Some bug 2
+Subject: Another bug discussion
In-Reply-To: <Unknown>
Message-ID: <Sub-Discussion>
From: person@email.com
@@ -113,7 +113,7 @@ Bug report`,
"<A-Base>": {
Subject: "Thread A",
MessageID: "<A-Base>",
- Type: dashapi.DiscussionReport,
+ Type: dashapi.DiscussionMention,
Messages: []*email.Email{
{
MessageID: "<A-Base>",
@@ -198,9 +198,9 @@ Bug report`,
},
},
"<Sub-Discussion>": {
- Subject: "[syzbot] Some bug 2",
+ Subject: "Another bug discussion",
MessageID: "<Sub-Discussion>",
- Type: dashapi.DiscussionReport,
+ Type: dashapi.DiscussionMention,
BugIDs: []string{"4564456"},
Messages: []*email.Email{
{
@@ -209,7 +209,7 @@ Bug report`,
Date: time.Date(2017, time.May, 7, 19, 57, 0, 0, zone),
BugIDs: []string{"4564456"},
Cc: []string{"person@email.com"},
- Subject: "[syzbot] Some bug 2",
+ Subject: "Another bug discussion",
Author: "person@email.com",
Command: email.CmdNone,
},
@@ -263,16 +263,24 @@ func TestDiscussionType(t *testing.T) {
},
{
msg: &email.Email{
- Subject: "[syzbot] Monthly ext4 report",
+ Subject: "[syzbot] Monthly ext4 report",
+ OwnEmail: true,
},
ret: dashapi.DiscussionReminder,
},
{
msg: &email.Email{
- Subject: "[syzbot] WARNING in abcd",
+ Subject: "[syzbot] WARNING in abcd",
+ OwnEmail: true,
},
ret: dashapi.DiscussionReport,
},
+ {
+ msg: &email.Email{
+ Subject: "Some human-reported bug",
+ },
+ ret: dashapi.DiscussionMention,
+ },
}
for _, test := range tests {
got := DiscussionType(test.msg)