From 3322f4d7ccc2f2f372407b246df010bc84464c15 Mon Sep 17 00:00:00 2001 From: zeripath Date: Sat, 19 Mar 2022 16:20:03 +0000 Subject: [PATCH] not send notification emails to inactive users (part 2) (#19142) Unfortunately fixing changes to `mail_issue.go` did not get included in #19131. We also need to not send issue comment mails to deactivated users. Fix #18950 Signed-off-by: Andrew Thornton --- services/mailer/mail_issue.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/mailer/mail_issue.go b/services/mailer/mail_issue.go index bd5008f076..1451150347 100644 --- a/services/mailer/mail_issue.go +++ b/services/mailer/mail_issue.go @@ -126,6 +126,10 @@ func mailIssueCommentBatch(ctx *mailCommentContext, users []*user_model.User, vi langMap := make(map[string][]*user_model.User) for _, user := range users { + if !user.IsActive { + // Exclude deactivated users + continue + } // At this point we exclude: // user that don't have all mails enabled or users only get mail on mention and this is one ... if !(user.EmailNotificationsPreference == user_model.EmailNotificationsEnabled ||