aboutsummaryrefslogtreecommitdiffstats
path: root/services/mailer
diff options
context:
space:
mode:
authorJimmy Praet <jimmy.praet@telenet.be>2021-05-30 11:38:38 +0200
committerGitHub <noreply@github.com>2021-05-30 10:38:38 +0100
commitd79c8bc30241c98e044de40aa673138e819f765f (patch)
tree24f7df4168afa3b020c569346a192da6176b0ae8 /services/mailer
parentd8c99c64d5bca4b280a1639677d4457fb6ebabcc (diff)
downloadgitea-d79c8bc30241c98e044de40aa673138e819f765f.tar.gz
gitea-d79c8bc30241c98e044de40aa673138e819f765f.zip
Don't manipulate input params in email notification (#16011)
Diffstat (limited to 'services/mailer')
-rw-r--r--services/mailer/mail_comment.go6
-rw-r--r--services/mailer/mail_issue.go8
2 files changed, 12 insertions, 2 deletions
diff --git a/services/mailer/mail_comment.go b/services/mailer/mail_comment.go
index f73c9fb637..eca05cef29 100644
--- a/services/mailer/mail_comment.go
+++ b/services/mailer/mail_comment.go
@@ -11,12 +11,16 @@ import (
// MailParticipantsComment sends new comment emails to repository watchers and mentioned people.
func MailParticipantsComment(c *models.Comment, opType models.ActionType, issue *models.Issue, mentions []*models.User) error {
+ content := c.Content
+ if c.Type == models.CommentTypePullPush {
+ content = ""
+ }
if err := mailIssueCommentToParticipants(
&mailCommentContext{
Issue: issue,
Doer: c.Poster,
ActionType: opType,
- Content: c.Content,
+ Content: content,
Comment: c,
}, mentions); err != nil {
log.Error("mailIssueCommentToParticipants: %v", err)
diff --git a/services/mailer/mail_issue.go b/services/mailer/mail_issue.go
index cf5265872b..867aa32517 100644
--- a/services/mailer/mail_issue.go
+++ b/services/mailer/mail_issue.go
@@ -161,12 +161,18 @@ func mailIssueCommentBatch(ctx *mailCommentContext, users []*models.User, visite
// MailParticipants sends new issue thread created emails to repository watchers
// and mentioned people.
func MailParticipants(issue *models.Issue, doer *models.User, opType models.ActionType, mentions []*models.User) error {
+ content := issue.Content
+ if opType == models.ActionCloseIssue || opType == models.ActionClosePullRequest ||
+ opType == models.ActionReopenIssue || opType == models.ActionReopenPullRequest ||
+ opType == models.ActionMergePullRequest {
+ content = ""
+ }
if err := mailIssueCommentToParticipants(
&mailCommentContext{
Issue: issue,
Doer: doer,
ActionType: opType,
- Content: issue.Content,
+ Content: content,
Comment: nil,
}, mentions); err != nil {
log.Error("mailIssueCommentToParticipants: %v", err)