aboutsummaryrefslogtreecommitdiffstats
path: root/dashboard
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2022-12-07 16:31:10 +0100
committerAleksandr Nogikh <wp32pw@gmail.com>2022-12-09 13:55:42 +0100
commit1d0805454ba8a4dac59fc8fbc5952eb035c4d71d (patch)
tree596c02a8aa2acc1832d5dcd49542354c999f59de /dashboard
parentbe94e4895a14874a42683e09e433cbdb1d7f81d2 (diff)
dashboard: make bisectFromJob() independent from dashapi.BugReport
Diffstat (limited to 'dashboard')
-rw-r--r--dashboard/app/jobs.go15
-rw-r--r--dashboard/app/reporting.go4
2 files changed, 12 insertions, 7 deletions
diff --git a/dashboard/app/jobs.go b/dashboard/app/jobs.go
index 00a027764..fd1291e48 100644
--- a/dashboard/app/jobs.go
+++ b/dashboard/app/jobs.go
@@ -910,12 +910,14 @@ func createBugReportForJob(c context.Context, job *Job, jobKey *db.Key, config i
if bugReporting.CC != "" {
rep.CC = strings.Split(bugReporting.CC, "|")
}
+ var emails []string
switch job.Type {
case JobBisectCause:
- rep.BisectCause = bisectFromJob(c, rep, job)
+ rep.BisectCause, emails = bisectFromJob(c, job)
case JobBisectFix:
- rep.BisectFix = bisectFromJob(c, rep, job)
+ rep.BisectFix, emails = bisectFromJob(c, job)
}
+ rep.Maintainers = append(rep.Maintainers, emails...)
}
if mgr := bug.managerConfig(); mgr != nil {
rep.CC = append(rep.CC, mgr.CC.Always...)
@@ -934,7 +936,7 @@ func createBugReportForJob(c context.Context, job *Job, jobKey *db.Key, config i
return rep, nil
}
-func bisectFromJob(c context.Context, rep *dashapi.BugReport, job *Job) *dashapi.BisectResult {
+func bisectFromJob(c context.Context, job *Job) (*dashapi.BisectResult, []string) {
bisect := &dashapi.BisectResult{
LogLink: externalLink(c, textLog, job.Log),
CrashLogLink: externalLink(c, textCrashLog, job.CrashLog),
@@ -950,14 +952,15 @@ func bisectFromJob(c context.Context, rep *dashapi.BugReport, job *Job) *dashapi
Date: com.Date,
})
}
+ var newEmails []string
if len(bisect.Commits) == 1 {
bisect.Commit = bisect.Commits[0]
bisect.Commits = nil
com := job.Commits[0]
- rep.Maintainers = append(rep.Maintainers, com.Author)
- rep.Maintainers = append(rep.Maintainers, strings.Split(com.CC, "|")...)
+ newEmails = []string{com.Author}
+ newEmails = append(newEmails, strings.Split(com.CC, "|")...)
}
- return bisect
+ return bisect, newEmails
}
func jobReported(c context.Context, jobID string) error {
diff --git a/dashboard/app/reporting.go b/dashboard/app/reporting.go
index b7c6be72c..ba56c8075 100644
--- a/dashboard/app/reporting.go
+++ b/dashboard/app/reporting.go
@@ -412,7 +412,9 @@ func createBugReport(c context.Context, bug *Bug, crash *Crash, crashKey *db.Key
return nil, err
}
if job != nil {
- rep.BisectCause = bisectFromJob(c, rep, job)
+ cause, emails := bisectFromJob(c, job)
+ rep.BisectCause = cause
+ rep.Maintainers = append(rep.Maintainers, emails...)
}
return rep, nil
}