dashboard/app: remove ReportingType.NeedMaintainers

Instead require DefaultMaintainers if MailMaintainers is set.
This makes logic in needReport a bit simpler.
This commit is contained in:
Dmitry Vyukov 2019-02-19 10:04:59 +01:00
parent 647e8b6e47
commit 4df543c9ab
4 changed files with 3 additions and 15 deletions

View File

@ -223,10 +223,6 @@ func (cfg *TestConfig) Type() string {
return "test"
}
func (cfg *TestConfig) NeedMaintainers() bool {
return false
}
func (cfg *TestConfig) Validate() error {
return nil
}

View File

@ -111,8 +111,6 @@ type Reporting struct {
type ReportingType interface {
// Type returns a unique string that identifies this reporting type (e.g. "email").
Type() string
// NeedMaintainers says if this reporting requires non-empty maintainers list.
NeedMaintainers() bool
// Validate validates the current object, this is called only during init.
Validate() error
}

View File

@ -126,11 +126,6 @@ func needReport(c context.Context, typ string, state *ReportingState, bug *Bug)
reporting, bugReporting = nil, nil
return
}
if reporting.Config.NeedMaintainers() && len(crash.Maintainers) == 0 {
status = fmt.Sprintf("%v: no maintainers", reporting.DisplayTitle)
reporting, bugReporting = nil, nil
return
}
// Limit number of reports sent per day,
// but don't limit sending repros to already reported bugs.

View File

@ -66,10 +66,6 @@ func (cfg *EmailConfig) Type() string {
return emailType
}
func (cfg *EmailConfig) NeedMaintainers() bool {
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)
@ -82,6 +78,9 @@ func (cfg *EmailConfig) Validate() error {
if cfg.Moderation && cfg.MailMaintainers {
return fmt.Errorf("both Moderation and MailMaintainers set")
}
if cfg.MailMaintainers && len(cfg.DefaultMaintainers) == 0 {
return fmt.Errorf("MailMaintainers is set but no DefaultMaintainers")
}
return nil
}