|
|
@ -27,7 +27,7 @@ func NewNotifier() base.Notifier { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (m *mailNotifier) NotifyCreateIssueComment(doer *models.User, repo *models.Repository, |
|
|
|
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 |
|
|
|
var act models.ActionType |
|
|
|
if comment.Type == models.CommentTypeClose { |
|
|
|
if comment.Type == models.CommentTypeClose { |
|
|
|
act = models.ActionCloseIssue |
|
|
|
act = models.ActionCloseIssue |
|
|
@ -41,13 +41,13 @@ func (m *mailNotifier) NotifyCreateIssueComment(doer *models.User, repo *models. |
|
|
|
act = 0 |
|
|
|
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) |
|
|
|
log.Error("MailParticipantsComment: %v", err) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (m *mailNotifier) NotifyNewIssue(issue *models.Issue) { |
|
|
|
func (m *mailNotifier) NotifyNewIssue(issue *models.Issue, mentions []*models.User) { |
|
|
|
if err := mailer.MailParticipants(issue, issue.Poster, models.ActionCreateIssue); err != nil { |
|
|
|
if err := mailer.MailParticipants(issue, issue.Poster, models.ActionCreateIssue, mentions); err != nil { |
|
|
|
log.Error("MailParticipants: %v", err) |
|
|
|
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) |
|
|
|
log.Error("MailParticipants: %v", err) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (m *mailNotifier) NotifyNewPullRequest(pr *models.PullRequest) { |
|
|
|
func (m *mailNotifier) NotifyNewPullRequest(pr *models.PullRequest, mentions []*models.User) { |
|
|
|
if err := mailer.MailParticipants(pr.Issue, pr.Issue.Poster, models.ActionCreatePullRequest); err != nil { |
|
|
|
if err := mailer.MailParticipants(pr.Issue, pr.Issue.Poster, models.ActionCreatePullRequest, mentions); err != nil { |
|
|
|
log.Error("MailParticipants: %v", err) |
|
|
|
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 |
|
|
|
var act models.ActionType |
|
|
|
if comment.Type == models.CommentTypeClose { |
|
|
|
if comment.Type == models.CommentTypeClose { |
|
|
|
act = models.ActionCloseIssue |
|
|
|
act = models.ActionCloseIssue |
|
|
@ -89,11 +89,17 @@ func (m *mailNotifier) NotifyPullRequestReview(pr *models.PullRequest, r *models |
|
|
|
} else if comment.Type == models.CommentTypeComment { |
|
|
|
} else if comment.Type == models.CommentTypeComment { |
|
|
|
act = models.ActionCommentPull |
|
|
|
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) |
|
|
|
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) { |
|
|
|
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
|
|
|
|
// mail only sent to added assignees and not self-assignee
|
|
|
|
if !removed && doer.ID != assignee.ID && assignee.EmailNotifications() == models.EmailNotificationsEnabled { |
|
|
|
if !removed && doer.ID != assignee.ID && assignee.EmailNotifications() == models.EmailNotificationsEnabled { |
|
|
@ -115,7 +121,7 @@ func (m *mailNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *mode |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
pr.Issue.Content = "" |
|
|
|
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) |
|
|
|
log.Error("MailParticipants: %v", err) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -143,7 +149,7 @@ func (m *mailNotifier) NotifyPullRequestPushCommits(doer *models.User, pr *model |
|
|
|
} |
|
|
|
} |
|
|
|
comment.Content = "" |
|
|
|
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) { |
|
|
|
func (m *mailNotifier) NotifyNewRelease(rel *models.Release) { |
|
|
|