From 4df543c9abc4c2accf97f4be85b210c772522329 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 19 Feb 2019 10:04:59 +0100 Subject: dashboard/app: remove ReportingType.NeedMaintainers Instead require DefaultMaintainers if MailMaintainers is set. This makes logic in needReport a bit simpler. --- dashboard/app/app_test.go | 4 ---- dashboard/app/config.go | 2 -- dashboard/app/reporting.go | 5 ----- dashboard/app/reporting_email.go | 7 +++---- 4 files changed, 3 insertions(+), 15 deletions(-) diff --git a/dashboard/app/app_test.go b/dashboard/app/app_test.go index a63f6e8d9..63822d9e4 100644 --- a/dashboard/app/app_test.go +++ b/dashboard/app/app_test.go @@ -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 } diff --git a/dashboard/app/config.go b/dashboard/app/config.go index 03412a4ed..b72c180c7 100644 --- a/dashboard/app/config.go +++ b/dashboard/app/config.go @@ -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 } diff --git a/dashboard/app/reporting.go b/dashboard/app/reporting.go index c038c67cb..183ff5a75 100644 --- a/dashboard/app/reporting.go +++ b/dashboard/app/reporting.go @@ -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. diff --git a/dashboard/app/reporting_email.go b/dashboard/app/reporting_email.go index 799820fb4..881767a8b 100644 --- a/dashboard/app/reporting_email.go +++ b/dashboard/app/reporting_email.go @@ -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 } -- cgit mrf-deployment