mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-25 17:30:36 +00:00
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.
This commit is contained in:
parent
024fe11cd3
commit
3081e7e153
2 changed files with 13 additions and 3 deletions
|
@ -183,6 +183,14 @@ func (t CommentType) HasAttachmentSupport() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t CommentType) HasMailReplySupport() bool {
|
||||||
|
switch t {
|
||||||
|
case CommentTypeComment, CommentTypeCode, CommentTypeReview, CommentTypeDismissReview, CommentTypeReopen, CommentTypeClose, CommentTypeMergePull, CommentTypeAssignees:
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// RoleInRepo presents the user's participation in the repo
|
// RoleInRepo presents the user's participation in the repo
|
||||||
type RoleInRepo string
|
type RoleInRepo string
|
||||||
|
|
||||||
|
|
|
@ -290,8 +290,10 @@ func composeIssueCommentMessages(ctx *mailCommentContext, lang string, recipient
|
||||||
reference := createReference(ctx.Issue, nil, activities_model.ActionType(0))
|
reference := createReference(ctx.Issue, nil, activities_model.ActionType(0))
|
||||||
|
|
||||||
var replyPayload []byte
|
var replyPayload []byte
|
||||||
if ctx.Comment != nil && ctx.Comment.Type == issues_model.CommentTypeCode {
|
if ctx.Comment != nil {
|
||||||
|
if ctx.Comment.Type.HasMailReplySupport() {
|
||||||
replyPayload, err = incoming_payload.CreateReferencePayload(ctx.Comment)
|
replyPayload, err = incoming_payload.CreateReferencePayload(ctx.Comment)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
replyPayload, err = incoming_payload.CreateReferencePayload(ctx.Issue)
|
replyPayload, err = incoming_payload.CreateReferencePayload(ctx.Issue)
|
||||||
}
|
}
|
||||||
|
@ -316,7 +318,7 @@ func composeIssueCommentMessages(ctx *mailCommentContext, lang string, recipient
|
||||||
listUnsubscribe := []string{"<" + ctx.Issue.HTMLURL() + ">"}
|
listUnsubscribe := []string{"<" + ctx.Issue.HTMLURL() + ">"}
|
||||||
|
|
||||||
if setting.IncomingEmail.Enabled {
|
if setting.IncomingEmail.Enabled {
|
||||||
if ctx.Comment != nil {
|
if replyPayload != nil {
|
||||||
token, err := token.CreateToken(token.ReplyHandlerType, recipient, replyPayload)
|
token, err := token.CreateToken(token.ReplyHandlerType, recipient, replyPayload)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("CreateToken failed: %v", err)
|
log.Error("CreateToken failed: %v", err)
|
||||||
|
|
Loading…
Reference in a new issue