mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-22 13:45:19 +00:00
Don't manipulate input params in email notification (#16011)
This commit is contained in:
parent
d8c99c64d5
commit
d79c8bc302
|
@ -54,7 +54,6 @@ func (m *mailNotifier) NotifyNewIssue(issue *models.Issue, mentions []*models.Us
|
||||||
|
|
||||||
func (m *mailNotifier) NotifyIssueChangeStatus(doer *models.User, issue *models.Issue, actionComment *models.Comment, isClosed bool) {
|
func (m *mailNotifier) NotifyIssueChangeStatus(doer *models.User, issue *models.Issue, actionComment *models.Comment, isClosed bool) {
|
||||||
var actionType models.ActionType
|
var actionType models.ActionType
|
||||||
issue.Content = ""
|
|
||||||
if issue.IsPull {
|
if issue.IsPull {
|
||||||
if isClosed {
|
if isClosed {
|
||||||
actionType = models.ActionClosePullRequest
|
actionType = models.ActionClosePullRequest
|
||||||
|
@ -124,7 +123,6 @@ func (m *mailNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *mode
|
||||||
log.Error("pr.LoadIssue: %v", err)
|
log.Error("pr.LoadIssue: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
pr.Issue.Content = ""
|
|
||||||
if err := mailer.MailParticipants(pr.Issue, doer, models.ActionMergePullRequest, nil); err != nil {
|
if err := mailer.MailParticipants(pr.Issue, doer, models.ActionMergePullRequest, nil); err != nil {
|
||||||
log.Error("MailParticipants: %v", err)
|
log.Error("MailParticipants: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -151,8 +149,6 @@ func (m *mailNotifier) NotifyPullRequestPushCommits(doer *models.User, pr *model
|
||||||
if err := comment.LoadPushCommits(); err != nil {
|
if err := comment.LoadPushCommits(); err != nil {
|
||||||
log.Error("comment.LoadPushCommits: %v", err)
|
log.Error("comment.LoadPushCommits: %v", err)
|
||||||
}
|
}
|
||||||
comment.Content = ""
|
|
||||||
|
|
||||||
m.NotifyCreateIssueComment(doer, comment.Issue.Repo, comment.Issue, comment, nil)
|
m.NotifyCreateIssueComment(doer, comment.Issue.Repo, comment.Issue, comment, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,12 +11,16 @@ import (
|
||||||
|
|
||||||
// MailParticipantsComment sends new comment emails to repository watchers and mentioned people.
|
// 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 {
|
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(
|
if err := mailIssueCommentToParticipants(
|
||||||
&mailCommentContext{
|
&mailCommentContext{
|
||||||
Issue: issue,
|
Issue: issue,
|
||||||
Doer: c.Poster,
|
Doer: c.Poster,
|
||||||
ActionType: opType,
|
ActionType: opType,
|
||||||
Content: c.Content,
|
Content: content,
|
||||||
Comment: c,
|
Comment: c,
|
||||||
}, mentions); err != nil {
|
}, mentions); err != nil {
|
||||||
log.Error("mailIssueCommentToParticipants: %v", err)
|
log.Error("mailIssueCommentToParticipants: %v", err)
|
||||||
|
|
|
@ -161,12 +161,18 @@ func mailIssueCommentBatch(ctx *mailCommentContext, users []*models.User, visite
|
||||||
// MailParticipants sends new issue thread created emails to repository watchers
|
// MailParticipants sends new issue thread created emails to repository watchers
|
||||||
// and mentioned people.
|
// and mentioned people.
|
||||||
func MailParticipants(issue *models.Issue, doer *models.User, opType models.ActionType, mentions []*models.User) error {
|
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(
|
if err := mailIssueCommentToParticipants(
|
||||||
&mailCommentContext{
|
&mailCommentContext{
|
||||||
Issue: issue,
|
Issue: issue,
|
||||||
Doer: doer,
|
Doer: doer,
|
||||||
ActionType: opType,
|
ActionType: opType,
|
||||||
Content: issue.Content,
|
Content: content,
|
||||||
Comment: nil,
|
Comment: nil,
|
||||||
}, mentions); err != nil {
|
}, mentions); err != nil {
|
||||||
log.Error("mailIssueCommentToParticipants: %v", err)
|
log.Error("mailIssueCommentToParticipants: %v", err)
|
||||||
|
|
Loading…
Reference in a new issue