From 51da1a16a02686054265c68525e7388e398cce73 Mon Sep 17 00:00:00 2001 From: Kailash Nadh Date: Fri, 24 Sep 2021 19:28:32 +0530 Subject: [PATCH] Add check to skip admin notifications with no e-mails. Closes #300. --- cmd/notifications.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/notifications.go b/cmd/notifications.go index 3fd0406c..896bc97e 100644 --- a/cmd/notifications.go +++ b/cmd/notifications.go @@ -22,6 +22,10 @@ type notifData struct { // sendNotification sends out an e-mail notification to admins. func (app *App) sendNotification(toEmails []string, subject, tplName string, data interface{}) error { + if len(toEmails) == 0 { + return nil + } + var b bytes.Buffer if err := app.notifTpls.ExecuteTemplate(&b, tplName, data); err != nil { app.log.Printf("error compiling notification template '%s': %v", tplName, err)