aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-12-19 15:03:33 +0100
committerDmitry Vyukov <dvyukov@google.com>2017-12-19 15:03:33 +0100
commit2d836b1d351fca1fcf99da0ab2718fdcc688260d (patch)
tree44f478630c4ba628ca20a97e7853237e08e1e723
parentaf9163c76381c5363976d40392f9f6728d7a1dc9 (diff)
dashboard/app: add default maintainers to email config
Crashes without maintainers are nasty. There is no way to do anything with them without altering the datastore (they are not mailed). Add DefaultMaintainers to email config. These addresses are added to all reported bugs as maintainers (e.g. LKML). One the report is mailed it's possible to CC more people on it.
-rw-r--r--dashboard/app/reporting_email.go16
1 files changed, 11 insertions, 5 deletions
diff --git a/dashboard/app/reporting_email.go b/dashboard/app/reporting_email.go
index c7c3c005f..0a06c974b 100644
--- a/dashboard/app/reporting_email.go
+++ b/dashboard/app/reporting_email.go
@@ -41,9 +41,10 @@ const emailType = "email"
var mailingLists map[string]bool
type EmailConfig struct {
- Email string
- Moderation bool
- MailMaintainers bool
+ Email string
+ Moderation bool
+ MailMaintainers bool
+ DefaultMaintainers []string
}
func (cfg *EmailConfig) Type() string {
@@ -51,13 +52,18 @@ func (cfg *EmailConfig) Type() string {
}
func (cfg *EmailConfig) NeedMaintainers() bool {
- return cfg.MailMaintainers
+ return cfg.MailMaintainers && len(cfg.DefaultMaintainers) == 0
}
func (cfg *EmailConfig) Validate() error {
if _, err := mail.ParseAddress(cfg.Email); err != nil {
return fmt.Errorf("bad email address %q: %v", cfg.Email, err)
}
+ for _, email := range cfg.DefaultMaintainers {
+ if _, err := mail.ParseAddress(email); err != nil {
+ return fmt.Errorf("bad email address %q: %v", email, err)
+ }
+ }
if cfg.Moderation && cfg.MailMaintainers {
return fmt.Errorf("both Moderation and MailMaintainers set")
}
@@ -130,7 +136,7 @@ func emailReport(c context.Context, rep *dashapi.BugReport, templ string) error
}
to := []string{cfg.Email}
if cfg.MailMaintainers {
- to = append(to, rep.Maintainers...)
+ to = email.MergeEmailLists(to, rep.Maintainers, cfg.DefaultMaintainers)
}
to = email.MergeEmailLists(to, rep.CC)
var attachments []aemail.Attachment