summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorTyrone Yeh <siryeh@gmail.com>2022-07-28 16:30:12 +0800
committerGitHub <noreply@github.com>2022-07-28 16:30:12 +0800
commit3bd8f50af819b8dfc86b9fecdfc36ca7774c6a2d (patch)
treeffa9a1e950cb96602e7057d73e9b2dc795357ac9 /services
parent86e5268c396bd89716b2617a4949837982c1b0c3 (diff)
downloadgitea-3bd8f50af819b8dfc86b9fecdfc36ca7774c6a2d.tar.gz
gitea-3bd8f50af819b8dfc86b9fecdfc36ca7774c6a2d.zip
Added email notification option to receive all own messages (#20179)
Sometimes users want to receive email notifications of messages they create or reply to, Added an option to personal preferences to allow users to choose Closes #20149
Diffstat (limited to 'services')
-rw-r--r--services/mailer/mail_issue.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/services/mailer/mail_issue.go b/services/mailer/mail_issue.go
index 5c330f6e00..b4827e83a7 100644
--- a/services/mailer/mail_issue.go
+++ b/services/mailer/mail_issue.go
@@ -91,7 +91,9 @@ func mailIssueCommentToParticipants(ctx *mailCommentContext, mentions []*user_mo
visited := make(map[int64]bool, len(unfiltered)+len(mentions)+1)
// Avoid mailing the doer
- visited[ctx.Doer.ID] = true
+ if ctx.Doer.EmailNotificationsPreference != user_model.EmailNotificationsAndYourOwn {
+ visited[ctx.Doer.ID] = true
+ }
// =========== Mentions ===========
if err = mailIssueCommentBatch(ctx, mentions, visited, true); err != nil {
@@ -133,6 +135,7 @@ func mailIssueCommentBatch(ctx *mailCommentContext, users []*user_model.User, vi
// 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 ||
+ user.EmailNotificationsPreference == user_model.EmailNotificationsAndYourOwn ||
fromMention && user.EmailNotificationsPreference == user_model.EmailNotificationsOnMention) {
continue
}