summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-02-27 11:07:05 +0100
committerGitHub <noreply@github.com>2020-02-27 10:07:05 +0000
commita924a90349a78ebe8e7eb560e435a7ddc1de9b84 (patch)
tree68e12c711eff73d045cd2b3e29ba34706d8fc577 /services
parent9a476113f01602f8418f8f66e7eceac27fd480c5 (diff)
downloadgitea-a924a90349a78ebe8e7eb560e435a7ddc1de9b84.tar.gz
gitea-a924a90349a78ebe8e7eb560e435a7ddc1de9b84.zip
[BugFix] Avoid mailing explicit unwatched (#10475)
* Avoid mailing explicit unwatched * CI.restart() * back to normal Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
Diffstat (limited to 'services')
-rw-r--r--services/mailer/mail_issue.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/services/mailer/mail_issue.go b/services/mailer/mail_issue.go
index 696adfadda..1030a9548e 100644
--- a/services/mailer/mail_issue.go
+++ b/services/mailer/mail_issue.go
@@ -62,7 +62,7 @@ func mailIssueCommentToParticipants(ctx *mailCommentContext, mentions []int64) e
unfiltered = append(unfiltered, ids...)
// =========== Issue watchers ===========
- ids, err = models.GetIssueWatchersIDs(ctx.Issue.ID)
+ ids, err = models.GetIssueWatchersIDs(ctx.Issue.ID, true)
if err != nil {
return fmt.Errorf("GetIssueWatchersIDs(%d): %v", ctx.Issue.ID, err)
}
@@ -80,6 +80,14 @@ func mailIssueCommentToParticipants(ctx *mailCommentContext, mentions []int64) e
// Avoid mailing the doer
visited[ctx.Doer.ID] = true
+ // Avoid mailing explicit unwatched
+ ids, err = models.GetIssueWatchersIDs(ctx.Issue.ID, false)
+ if err != nil {
+ return fmt.Errorf("GetIssueWatchersIDs(%d): %v", ctx.Issue.ID, err)
+ }
+ for _, i := range ids {
+ visited[i] = true
+ }
if err = mailIssueCommentBatch(ctx, unfiltered, visited, false); err != nil {
return fmt.Errorf("mailIssueCommentBatch(): %v", err)