Skip to content

Fix missing mail reply address #27997

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions models/issues/comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,14 @@ func (t CommentType) HasAttachmentSupport() bool {
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
type RoleInRepo string

Expand Down
8 changes: 5 additions & 3 deletions services/mailer/mail.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
Expand Down