Skip to content

Commit

Permalink
Add check to skip admin notifications with no e-mails. Closes #300.
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Sep 24, 2021
1 parent c2a3f7d commit 51da1a1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 51da1a1

Please sign in to comment.