models/issue_mail: add assignee to issue related emails (#5628)

Reference #4220
pull/5650/head
Andy Hochhaus 2019-02-20 17:04:38 -06:00 committed by 无闻
parent 8b383f86de
commit e19c026083
1 changed files with 7 additions and 1 deletions

View File

@ -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.