diff options
author | 无闻 <joe2010xtmf@163.com> | 2014-04-04 10:40:14 -0400 |
---|---|---|
committer | 无闻 <joe2010xtmf@163.com> | 2014-04-04 10:40:14 -0400 |
commit | 3a23476dbef0bb90ce5e8bc4c7ab8929bc04bb1b (patch) | |
tree | 8cfb016c545a0b7583fcb7e7acc5a11fc11c20a2 /modules/mailer/mail.go | |
parent | 48d3a1fef12242c6f5c1848ca58e02d946a709da (diff) | |
parent | 75db79b4b6bcb8f61dd957c9bd21b32d4746f866 (diff) |
Merge pull request #61 from gogits/dev
Dev
Diffstat (limited to 'modules/mailer/mail.go')
-rw-r--r-- | modules/mailer/mail.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/modules/mailer/mail.go b/modules/mailer/mail.go index d0decbe0..b99fc8fd 100644 --- a/modules/mailer/mail.go +++ b/modules/mailer/mail.go @@ -92,8 +92,8 @@ func SendActiveMail(r *middleware.Render, user *models.User) { } // SendNotifyMail sends mail notification of all watchers. -func SendNotifyMail(userId, repoId int64, userName, repoName, subject, content string) error { - watches, err := models.GetWatches(repoId) +func SendNotifyMail(user, owner *models.User, repo *models.Repository, issue *models.Issue) error { + watches, err := models.GetWatches(repo.Id) if err != nil { return errors.New("mail.NotifyWatchers(get watches): " + err.Error()) } @@ -101,7 +101,7 @@ func SendNotifyMail(userId, repoId int64, userName, repoName, subject, content s tos := make([]string, 0, len(watches)) for i := range watches { uid := watches[i].UserId - if userId == uid { + if user.Id == uid { continue } u, err := models.GetUserById(uid) @@ -115,7 +115,10 @@ func SendNotifyMail(userId, repoId int64, userName, repoName, subject, content s return nil } - msg := NewMailMessageFrom(tos, userName, subject, content) + subject := fmt.Sprintf("[%s] %s", repo.Name, issue.Name) + content := fmt.Sprintf("%s<br>-<br> <a href=\"%s%s/%s/issues/%d\">View it on Gogs</a>.", + issue.Content, base.AppUrl, owner.Name, repo.Name, issue.Index) + msg := NewMailMessageFrom(tos, user.Name, subject, content) msg.Info = fmt.Sprintf("Subject: %s, send notify emails", subject) SendAsync(&msg) return nil |