aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-02-23 11:24:43 +0100
committerDmitry Vyukov <dvyukov@google.com>2018-02-23 11:24:43 +0100
commit334641584880cd238fc32dc6f436e7e10efdf3de (patch)
tree1b8b748ce3e4795e934ba2cc8cf50949965f9c37
parent8d8e249484bcec5fdffec6bb37d6f3ccb9e27a7e (diff)
dashboard/app: prefix email replies with Re:
This plays an important role at least for job replies. If we CC a kernel mailing list and it uses Patchwork, then any emails with a patch attached create a new patch entry pending for review. The prefix makes Patchwork treat it as a comment for a previous patch.
-rw-r--r--dashboard/app/email_test.go6
-rw-r--r--dashboard/app/jobs_test.go2
-rw-r--r--dashboard/app/reporting_email.go13
3 files changed, 15 insertions, 6 deletions
diff --git a/dashboard/app/email_test.go b/dashboard/app/email_test.go
index 1afac448e..56d263c63 100644
--- a/dashboard/app/email_test.go
+++ b/dashboard/app/email_test.go
@@ -146,7 +146,7 @@ For more options, visit https://groups.google.com/d/optout.
config.Namespaces["test2"].Reporting[0].Config.(*EmailConfig).Email,
}
c.expectEQ(msg.To, to)
- c.expectEQ(msg.Subject, crash.Title)
+ c.expectEQ(msg.Subject, "Re: "+crash.Title)
c.expectEQ(len(msg.Attachments), 3)
c.expectEQ(msg.Attachments[0].Name, "raw.log.txt")
c.expectEQ(msg.Attachments[0].Data, crash.Log)
@@ -283,7 +283,7 @@ Content-Type: text/plain
c.expectEQ(sender, fromAddr(c.ctx))
c.expectEQ(msg.To, []string{"another@another.com", "bar@foo.com", "bugs@syzkaller.com",
"default@maintainers.com", "foo@bar.com", "new@new.com", "qux@qux.com"})
- c.expectEQ(msg.Subject, crash.Title)
+ c.expectEQ(msg.Subject, "Re: "+crash.Title)
c.expectEQ(len(msg.Attachments), 4)
c.expectEQ(msg.Attachments[0].Name, "raw.log.txt")
c.expectEQ(msg.Attachments[0].Data, crash.Log)
@@ -334,7 +334,7 @@ Content-Type: text/plain
c.expectEQ(len(c.emailSink), 1)
msg := <-c.emailSink
c.expectEQ(msg.To, []string{"<foo@bar.com>"})
- c.expectEQ(msg.Subject, crash.Title)
+ c.expectEQ(msg.Subject, "Re: title1")
c.expectEQ(msg.Headers["In-Reply-To"], []string{"<abcdef>"})
if !strings.Contains(msg.Body, `> #syz bad-command
diff --git a/dashboard/app/jobs_test.go b/dashboard/app/jobs_test.go
index f5124a382..40de2ce9b 100644
--- a/dashboard/app/jobs_test.go
+++ b/dashboard/app/jobs_test.go
@@ -136,7 +136,7 @@ func TestJob(t *testing.T) {
msg := <-c.emailSink
to := email.MergeEmailLists([]string{"test@requester.com", "somebody@else.com", mailingList})
c.expectEQ(msg.To, to)
- c.expectEQ(msg.Subject, crash.Title)
+ c.expectEQ(msg.Subject, "Re: "+crash.Title)
c.expectEQ(len(msg.Attachments), 3)
c.expectEQ(msg.Attachments[0].Name, "patch.diff")
c.expectEQ(msg.Attachments[0].Data, []byte(patch))
diff --git a/dashboard/app/reporting_email.go b/dashboard/app/reporting_email.go
index d41a503b8..bb2931325 100644
--- a/dashboard/app/reporting_email.go
+++ b/dashboard/app/reporting_email.go
@@ -39,7 +39,15 @@ func init() {
}
}
-const emailType = "email"
+const (
+ emailType = "email"
+ // This plays an important role at least for job replies.
+ // If we CC a kernel mailing list and it uses Patchwork,
+ // then any emails with a patch attached create a new patch
+ // entry pending for review. The prefix makes Patchwork
+ // treat it as a comment for a previous patch.
+ replySubjectPrefix = "Re: "
+)
var mailingLists map[string]bool
@@ -429,6 +437,7 @@ func sendMailTemplate(c context.Context, subject, from string, to []string, repl
}
if replyTo != "" {
msg.Headers = mail.Header{"In-Reply-To": []string{replyTo}}
+ msg.Subject = replySubjectPrefix + msg.Subject
}
return sendEmail(c, msg)
}
@@ -448,7 +457,7 @@ func replyTo(c context.Context, msg *email.Email, reply string, attachment *aema
Sender: from,
To: []string{msg.From},
Cc: msg.Cc,
- Subject: msg.Subject,
+ Subject: replySubjectPrefix + msg.Subject,
Body: email.FormReply(msg.Body, reply),
Attachments: attachments,
Headers: mail.Header{"In-Reply-To": []string{msg.MessageID}},