summaryrefslogtreecommitdiffstats
path: root/models/mail.go
diff options
context:
space:
mode:
authorLauris BH <lauris@nix.lv>2017-11-03 11:23:17 +0200
committerLunny Xiao <xiaolunwen@gmail.com>2017-11-03 17:23:17 +0800
commit240609432b84a8caa5ec4c99a916277952ef02d5 (patch)
tree4ceb81292f531bcdca34389079b8a711643cd4c6 /models/mail.go
parent8798cf4e3ba30bc0bdea073bf273ac27b71b78ce (diff)
downloadgitea-240609432b84a8caa5ec4c99a916277952ef02d5.tar.gz
gitea-240609432b84a8caa5ec4c99a916277952ef02d5.zip
Issue content should not be updated when closing with comment (#2833)
Diffstat (limited to 'models/mail.go')
-rw-r--r--models/mail.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/models/mail.go b/models/mail.go
index 98766f69f2..6b69e7b2ad 100644
--- a/models/mail.go
+++ b/models/mail.go
@@ -149,9 +149,9 @@ func composeTplData(subject, body, link string) map[string]interface{} {
return data
}
-func composeIssueCommentMessage(issue *Issue, doer *User, comment *Comment, tplName base.TplName, tos []string, info string) *mailer.Message {
+func composeIssueCommentMessage(issue *Issue, doer *User, content string, comment *Comment, tplName base.TplName, tos []string, info string) *mailer.Message {
subject := issue.mailSubject()
- body := string(markup.RenderByType(markdown.MarkupName, []byte(issue.Content), issue.Repo.HTMLURL(), issue.Repo.ComposeMetas()))
+ body := string(markup.RenderByType(markdown.MarkupName, []byte(content), issue.Repo.HTMLURL(), issue.Repo.ComposeMetas()))
data := make(map[string]interface{}, 10)
if comment != nil {
@@ -161,30 +161,30 @@ func composeIssueCommentMessage(issue *Issue, doer *User, comment *Comment, tplN
}
data["Doer"] = doer
- var content bytes.Buffer
+ var mailBody bytes.Buffer
- if err := templates.ExecuteTemplate(&content, string(tplName), data); err != nil {
+ if err := templates.ExecuteTemplate(&mailBody, string(tplName), data); err != nil {
log.Error(3, "Template: %v", err)
}
- msg := mailer.NewMessageFrom(tos, doer.DisplayName(), setting.MailService.FromEmail, subject, content.String())
+ msg := mailer.NewMessageFrom(tos, doer.DisplayName(), setting.MailService.FromEmail, subject, mailBody.String())
msg.Info = fmt.Sprintf("Subject: %s, %s", subject, info)
return msg
}
// SendIssueCommentMail composes and sends issue comment emails to target receivers.
-func SendIssueCommentMail(issue *Issue, doer *User, comment *Comment, tos []string) {
+func SendIssueCommentMail(issue *Issue, doer *User, content string, comment *Comment, tos []string) {
if len(tos) == 0 {
return
}
- mailer.SendAsync(composeIssueCommentMessage(issue, doer, comment, mailIssueComment, tos, "issue comment"))
+ mailer.SendAsync(composeIssueCommentMessage(issue, doer, content, comment, mailIssueComment, tos, "issue comment"))
}
// SendIssueMentionMail composes and sends issue mention emails to target receivers.
-func SendIssueMentionMail(issue *Issue, doer *User, comment *Comment, tos []string) {
+func SendIssueMentionMail(issue *Issue, doer *User, content string, comment *Comment, tos []string) {
if len(tos) == 0 {
return
}
- mailer.SendAsync(composeIssueCommentMessage(issue, doer, comment, mailIssueMention, tos, "issue mention"))
+ mailer.SendAsync(composeIssueCommentMessage(issue, doer, content, comment, mailIssueMention, tos, "issue mention"))
}