diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2023-11-13 04:20:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-13 03:20:34 +0000 |
commit | 3081e7e1536356346f73fb4a0d00101863b2cf05 (patch) | |
tree | 7fdf3a5e6a56c585cec8d23f24b0ed56d24f889c /services | |
parent | 024fe11cd31361740095a2f29b400e1a152454a7 (diff) | |
download | gitea-3081e7e1536356346f73fb4a0d00101863b2cf05.tar.gz gitea-3081e7e1536356346f73fb4a0d00101863b2cf05.zip |
Fix missing mail reply address (#27997)
Fixes https://codeberg.org/forgejo/forgejo/issues/1458
Some mails such as issue creation mails are missing the reply-to-comment
address. This PR fixes that and specifies which comment types should get
a reply-possibility.
Diffstat (limited to 'services')
-rw-r--r-- | services/mailer/mail.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/services/mailer/mail.go b/services/mailer/mail.go index 1f139d233f..b597dd0487 100644 --- a/services/mailer/mail.go +++ b/services/mailer/mail.go @@ -290,8 +290,10 @@ func composeIssueCommentMessages(ctx *mailCommentContext, lang string, recipient reference := createReference(ctx.Issue, nil, activities_model.ActionType(0)) var replyPayload []byte - if ctx.Comment != nil && ctx.Comment.Type == issues_model.CommentTypeCode { - replyPayload, err = incoming_payload.CreateReferencePayload(ctx.Comment) + if ctx.Comment != nil { + if ctx.Comment.Type.HasMailReplySupport() { + replyPayload, err = incoming_payload.CreateReferencePayload(ctx.Comment) + } } else { replyPayload, err = incoming_payload.CreateReferencePayload(ctx.Issue) } @@ -316,7 +318,7 @@ func composeIssueCommentMessages(ctx *mailCommentContext, lang string, recipient listUnsubscribe := []string{"<" + ctx.Issue.HTMLURL() + ">"} if setting.IncomingEmail.Enabled { - if ctx.Comment != nil { + if replyPayload != nil { token, err := token.CreateToken(token.ReplyHandlerType, recipient, replyPayload) if err != nil { log.Error("CreateToken failed: %v", err) |