diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2022-12-14 20:56:09 +0100 |
|---|---|---|
| committer | Aleksandr Nogikh <wp32pw@gmail.com> | 2022-12-16 10:22:43 +0100 |
| commit | 834650a0c890ce23f24e3ef5739aae79dcd054c1 (patch) | |
| tree | 288260d87553acab6a8b76b5a944bf0218f4fbfc | |
| parent | 48ec7344e13eaeee104976fb52d3ed30c1073d5d (diff) | |
dashboard: mention subsystems in the email Subject
| -rw-r--r-- | dashboard/app/email_test.go | 6 | ||||
| -rw-r--r-- | dashboard/app/reporting_email.go | 15 |
2 files changed, 18 insertions, 3 deletions
diff --git a/dashboard/app/email_test.go b/dashboard/app/email_test.go index 05f312c6c..29c76da9f 100644 --- a/dashboard/app/email_test.go +++ b/dashboard/app/email_test.go @@ -859,6 +859,12 @@ func TestSubjectTitleParser(t *testing.T) { outTitle: "", outSeq: 0, }, + { + // Make sure we delete filesystem tags. + inSubject: "Re: [syzbot] [ntfs3?] [ext4?] kernel BUG in blk_mq_dispatch_rq_list (4)", + outTitle: "kernel BUG in blk_mq_dispatch_rq_list", + outSeq: 3, + }, } p := subjectTitleParser{} diff --git a/dashboard/app/reporting_email.go b/dashboard/app/reporting_email.go index cb09c80e9..4ad745ca6 100644 --- a/dashboard/app/reporting_email.go +++ b/dashboard/app/reporting_email.go @@ -271,8 +271,17 @@ func emailReport(c context.Context, rep *dashapi.BugReport) error { if err := mailTemplates.ExecuteTemplate(body, templ, rep); err != nil { return fmt.Errorf("failed to execute %v template: %v", templ, err) } - log.Infof(c, "sending email %q to %q", rep.Title, to) - return sendMailText(c, cfg, rep.Title, from, to, rep.ExtID, body.String()) + title := generateEmailBugTitle(rep, cfg) + log.Infof(c, "sending email %q to %q", title, to) + return sendMailText(c, cfg, title, from, to, rep.ExtID, body.String()) +} + +func generateEmailBugTitle(rep *dashapi.BugReport, emailConfig *EmailConfig) string { + title := "" + for i := len(rep.Subsystems) - 1; i >= 0; i-- { + title = fmt.Sprintf("[%s?] %s", rep.Subsystems[i].Name, title) + } + return title + rep.Title } // handleIncomingMail is the entry point for incoming emails. @@ -626,7 +635,7 @@ func (p *subjectTitleParser) prepareRegexps() { } } rePrefixes := `^(?:(?:` + strings.Join(stripPrefixes, "|") + `)\s*)*` - p.pattern = regexp.MustCompile(rePrefixes + `(.*?)(?:\s\((\d+)\))?$`) + p.pattern = regexp.MustCompile(rePrefixes + `(?:\[[^\]]+\]\s*)*(.*?)(?:\s\((\d+)\))?$`) }) } |
