summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorJohn Olheiser <john.olheiser@gmail.com>2020-12-03 14:25:49 -0600
committerGitHub <noreply@github.com>2020-12-03 14:25:49 -0600
commitf0cc29761d4acdadc7db4b13128b15cc00c621c7 (patch)
treec2d26746809b3d39e198c9225d6023a0e89ae55f /services
parent5d43d2965a2e43833172220260a3985fdf89bea4 (diff)
downloadgitea-f0cc29761d4acdadc7db4b13128b15cc00c621c7.tar.gz
gitea-f0cc29761d4acdadc7db4b13128b15cc00c621c7.zip
Make sure email recipients can see issue (#13820)
* Initial pass Signed-off-by: jolheiser <john.olheiser@gmail.com> * Remove over-op Signed-off-by: jolheiser <john.olheiser@gmail.com>
Diffstat (limited to 'services')
-rw-r--r--services/mailer/mail_issue.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/services/mailer/mail_issue.go b/services/mailer/mail_issue.go
index 01c198984b..30b54eb6cb 100644
--- a/services/mailer/mail_issue.go
+++ b/services/mailer/mail_issue.go
@@ -122,7 +122,17 @@ func mailIssueCommentBatch(ctx *mailCommentContext, ids []int64, visited map[int
if err != nil {
return err
}
- // TODO: Check issue visibility for each user
+
+ // Make sure all recipients can still see the issue
+ idx := 0
+ for _, r := range recipients {
+ if ctx.Issue.Repo.CheckUnitUser(r, models.UnitTypeIssues) {
+ recipients[idx] = r
+ idx++
+ }
+ }
+ recipients = recipients[:idx]
+
// TODO: Separate recipients by language for i18n mail templates
tos := make([]string, len(recipients))
for i := range recipients {