diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-04-12 05:59:01 +0800 |
---|---|---|
committer | zeripath <art27@cantab.net> | 2019-04-11 22:59:01 +0100 |
commit | 2f53b5f88c15d031427695c50bda1f6fa50920cb (patch) | |
tree | c900b0e7c8c78d9af1d3b20c23418a5c1f04d787 /modules/notification | |
parent | 48cdd90d4e2f4807e8aa61315a49ca3d775213ef (diff) | |
download | gitea-2f53b5f88c15d031427695c50bda1f6fa50920cb.tar.gz gitea-2f53b5f88c15d031427695c50bda1f6fa50920cb.zip |
fix mail notification when close/reopen issue (#6581)
Diffstat (limited to 'modules/notification')
-rw-r--r-- | modules/notification/mail/mail.go | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/modules/notification/mail/mail.go b/modules/notification/mail/mail.go index 11682bf724..9689f4d4ab 100644 --- a/modules/notification/mail/mail.go +++ b/modules/notification/mail/mail.go @@ -42,19 +42,34 @@ func (m *mailNotifier) NotifyCreateIssueComment(doer *models.User, repo *models. } func (m *mailNotifier) NotifyNewIssue(issue *models.Issue) { - if err := issue.MailParticipants(); err != nil { + if err := issue.MailParticipants(models.ActionCreateIssue); err != nil { log.Error("MailParticipants: %v", err) } } func (m *mailNotifier) NotifyIssueChangeStatus(doer *models.User, issue *models.Issue, isClosed bool) { - if err := issue.MailParticipants(); err != nil { + var actionType models.ActionType + if issue.IsPull { + if isClosed { + actionType = models.ActionClosePullRequest + } else { + actionType = models.ActionReopenPullRequest + } + } else { + if isClosed { + actionType = models.ActionCloseIssue + } else { + actionType = models.ActionReopenIssue + } + } + + if err := issue.MailParticipants(actionType); err != nil { log.Error("MailParticipants: %v", err) } } func (m *mailNotifier) NotifyNewPullRequest(pr *models.PullRequest) { - if err := pr.Issue.MailParticipants(); err != nil { + if err := pr.Issue.MailParticipants(models.ActionCreatePullRequest); err != nil { log.Error("MailParticipants: %v", err) } } |