@ -82,8 +82,6 @@ func (h *ReplyHandler) Handle(ctx context.Context, content *MailContent, doer *u
return nil
}
switch r := ref . ( type ) {
case * issues_model . Issue :
attachmentIDs := make ( [ ] string , 0 , len ( content . Attachments ) )
if setting . Attachment . Enabled {
for _ , attachment := range content . Attachments {
@ -107,18 +105,17 @@ func (h *ReplyHandler) Handle(ctx context.Context, content *MailContent, doer *u
return nil
}
_ , err = issue_service . CreateIssueComment ( ctx , doer , issue . Repo , issue , content . Content , attachmentIDs )
switch r := ref . ( type ) {
case * issues_model . Issue :
_ , err := issue_service . CreateIssueComment ( ctx , doer , issue . Repo , issue , content . Content , attachmentIDs )
if err != nil {
return fmt . Errorf ( "CreateIssueComment failed: %w" , err )
}
case * issues_model . Comment :
comment := r
if content . Content == "" {
return nil
}
if comment . Type == issues_model . CommentTypeCode {
switch comment . Type {
case issues_model . CommentTypeCode :
_ , err := pull_service . CreateCodeComment (
ctx ,
doer ,
@ -130,11 +127,16 @@ func (h *ReplyHandler) Handle(ctx context.Context, content *MailContent, doer *u
false , // not pending review but a single review
comment . ReviewID ,
"" ,
nil ,
attachmentIDs ,
)
if err != nil {
return fmt . Errorf ( "CreateCodeComment failed: %w" , err )
}
default :
_ , err := issue_service . CreateIssueComment ( ctx , doer , issue . Repo , issue , content . Content , attachmentIDs )
if err != nil {
return fmt . Errorf ( "CreateIssueComment failed: %w" , err )
}
}
}
return nil