aboutsummaryrefslogtreecommitdiff
path: root/models
diff options
context:
space:
mode:
authorAndy Hochhaus <hochhaus@users.noreply.github.com>2019-02-20 17:04:38 -0600
committer无闻 <u@gogs.io>2019-02-20 18:04:38 -0500
commite19c02608361c6f2bdcba1113a76eeb48f176d60 (patch)
tree315c0334dac32b7cf7a969d63849fd96490b342f /models
parent8b383f86de84799494a1eb48bbe9006f5fa05919 (diff)
models/issue_mail: add assignee to issue related emails (#5628)
Reference #4220
Diffstat (limited to 'models')
-rw-r--r--models/issue_mail.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/models/issue_mail.go b/models/issue_mail.go
index b543c750..4a2f423e 100644
--- a/models/issue_mail.go
+++ b/models/issue_mail.go
@@ -92,7 +92,7 @@ func NewMailerIssue(issue *Issue) mailer.Issue {
// mailIssueCommentToParticipants can be used for both new issue creation and comment.
// This functions sends two list of emails:
-// 1. Repository watchers and users who are participated in comments.
+// 1. Repository watchers, users who participated in comments and the assignee.
// 2. Users who are not in 1. but get mentioned in current issue/comment.
func mailIssueCommentToParticipants(issue *Issue, doer *User, mentions []string) error {
if !setting.Service.EnableNotifyMail {
@@ -142,6 +142,12 @@ func mailIssueCommentToParticipants(issue *Issue, doer *User, mentions []string)
tos = append(tos, participants[i].Email)
names = append(names, participants[i].Name)
}
+ if issue.Assignee != nil && issue.Assignee.ID != doer.ID {
+ if !com.IsSliceContainsStr(names, issue.Assignee.Name) {
+ tos = append(tos, issue.Assignee.Email)
+ names = append(names, issue.Assignee.Name)
+ }
+ }
mailer.SendIssueCommentMail(NewMailerIssue(issue), NewMailerRepo(issue.Repo), NewMailerUser(doer), tos)
// Mail mentioned people and exclude watchers.