aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/email/lore/parse.go
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2023-04-11 16:53:24 +0200
committerAleksandr Nogikh <wp32pw@gmail.com>2023-04-12 13:55:59 +0200
commited75c0a7f1b7d6758be3942746675ff94071d154 (patch)
tree74a7117e09d4a5aeb11589f05e87106ec8d483ba /pkg/email/lore/parse.go
parentec77d7cc1b8bc1c3058c2bfdcfcccb781f338f20 (diff)
pkg/email/lore: skip syzbot-started subthreads
Adjust tests.
Diffstat (limited to 'pkg/email/lore/parse.go')
-rw-r--r--pkg/email/lore/parse.go25
1 files changed, 18 insertions, 7 deletions
diff --git a/pkg/email/lore/parse.go b/pkg/email/lore/parse.go
index 6d90f9ee5..84bb56352 100644
--- a/pkg/email/lore/parse.go
+++ b/pkg/email/lore/parse.go
@@ -36,22 +36,33 @@ func (c *parseCtx) record(msg *email.Email) {
func (c *parseCtx) threads() []*Thread {
threads := map[string]*Thread{}
threadsList := []*Thread{}
+
+ newThread := func(msg *email.Email) {
+ thread := &Thread{
+ MessageID: msg.MessageID,
+ Subject: msg.Subject,
+ }
+ threads[msg.MessageID] = thread
+ threadsList = append(threadsList, thread)
+ }
+
// Detect threads, i.e. messages without In-Reply-To.
for _, msg := range c.messages {
if msg.InReplyTo == "" {
- thread := &Thread{
- MessageID: msg.MessageID,
- Subject: msg.Subject,
- }
- threads[msg.MessageID] = thread
- threadsList = append(threadsList, thread)
+ newThread(msg)
}
}
// Assign messages to threads.
for _, msg := range c.messages {
base := c.first(msg)
if base == nil {
- continue
+ if msg.OwnEmail {
+ // Likely bot's reply to a non-public command. Ignore.
+ continue
+ }
+ // Pretend it's a separate discussion.
+ newThread(msg)
+ base = msg
}
thread := threads[base.MessageID]
thread.BugIDs = append(thread.BugIDs, msg.BugIDs...)