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