diff --git a/models/issues/comment.go b/models/issues/comment.go index 8e06838f7..f2a3cb7b0 100644 --- a/models/issues/comment.go +++ b/models/issues/comment.go @@ -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 diff --git a/services/mailer/mail.go b/services/mailer/mail.go index 1f139d233..b597dd048 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)