diff options
Diffstat (limited to 'modules/notification/mail/mail.go')
-rw-r--r-- | modules/notification/mail/mail.go | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/modules/notification/mail/mail.go b/modules/notification/mail/mail.go index 847a2f30a7..ee8a0c436c 100644 --- a/modules/notification/mail/mail.go +++ b/modules/notification/mail/mail.go @@ -27,7 +27,7 @@ func NewNotifier() base.Notifier { } func (m *mailNotifier) NotifyCreateIssueComment(doer *models.User, repo *models.Repository, - issue *models.Issue, comment *models.Comment) { + issue *models.Issue, comment *models.Comment, mentions []*models.User) { var act models.ActionType if comment.Type == models.CommentTypeClose { act = models.ActionCloseIssue @@ -41,13 +41,13 @@ func (m *mailNotifier) NotifyCreateIssueComment(doer *models.User, repo *models. act = 0 } - if err := mailer.MailParticipantsComment(comment, act, issue); err != nil { + if err := mailer.MailParticipantsComment(comment, act, issue, mentions); err != nil { log.Error("MailParticipantsComment: %v", err) } } -func (m *mailNotifier) NotifyNewIssue(issue *models.Issue) { - if err := mailer.MailParticipants(issue, issue.Poster, models.ActionCreateIssue); err != nil { +func (m *mailNotifier) NotifyNewIssue(issue *models.Issue, mentions []*models.User) { + if err := mailer.MailParticipants(issue, issue.Poster, models.ActionCreateIssue, mentions); err != nil { log.Error("MailParticipants: %v", err) } } @@ -69,18 +69,18 @@ func (m *mailNotifier) NotifyIssueChangeStatus(doer *models.User, issue *models. } } - if err := mailer.MailParticipants(issue, doer, actionType); err != nil { + if err := mailer.MailParticipants(issue, doer, actionType, nil); err != nil { log.Error("MailParticipants: %v", err) } } -func (m *mailNotifier) NotifyNewPullRequest(pr *models.PullRequest) { - if err := mailer.MailParticipants(pr.Issue, pr.Issue.Poster, models.ActionCreatePullRequest); err != nil { +func (m *mailNotifier) NotifyNewPullRequest(pr *models.PullRequest, mentions []*models.User) { + if err := mailer.MailParticipants(pr.Issue, pr.Issue.Poster, models.ActionCreatePullRequest, mentions); err != nil { log.Error("MailParticipants: %v", err) } } -func (m *mailNotifier) NotifyPullRequestReview(pr *models.PullRequest, r *models.Review, comment *models.Comment) { +func (m *mailNotifier) NotifyPullRequestReview(pr *models.PullRequest, r *models.Review, comment *models.Comment, mentions []*models.User) { var act models.ActionType if comment.Type == models.CommentTypeClose { act = models.ActionCloseIssue @@ -89,11 +89,17 @@ func (m *mailNotifier) NotifyPullRequestReview(pr *models.PullRequest, r *models } else if comment.Type == models.CommentTypeComment { act = models.ActionCommentPull } - if err := mailer.MailParticipantsComment(comment, act, pr.Issue); err != nil { + if err := mailer.MailParticipantsComment(comment, act, pr.Issue, mentions); err != nil { log.Error("MailParticipantsComment: %v", err) } } +func (m *mailNotifier) NotifyPullRequestCodeComment(pr *models.PullRequest, comment *models.Comment, mentions []*models.User) { + if err := mailer.MailMentionsComment(pr, comment, mentions); err != nil { + log.Error("MailMentionsComment: %v", err) + } +} + func (m *mailNotifier) NotifyIssueChangeAssignee(doer *models.User, issue *models.Issue, assignee *models.User, removed bool, comment *models.Comment) { // mail only sent to added assignees and not self-assignee if !removed && doer.ID != assignee.ID && assignee.EmailNotifications() == models.EmailNotificationsEnabled { @@ -115,7 +121,7 @@ func (m *mailNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *mode return } pr.Issue.Content = "" - if err := mailer.MailParticipants(pr.Issue, doer, models.ActionMergePullRequest); err != nil { + if err := mailer.MailParticipants(pr.Issue, doer, models.ActionMergePullRequest, nil); err != nil { log.Error("MailParticipants: %v", err) } } @@ -143,7 +149,7 @@ func (m *mailNotifier) NotifyPullRequestPushCommits(doer *models.User, pr *model } comment.Content = "" - m.NotifyCreateIssueComment(doer, comment.Issue.Repo, comment.Issue, comment) + m.NotifyCreateIssueComment(doer, comment.Issue.Repo, comment.Issue, comment, nil) } func (m *mailNotifier) NotifyNewRelease(rel *models.Release) { |