Extract createComment (#9125)

* Extract createComment

* fix lint

* fix lint
This commit is contained in:
Lunny Xiao 2019-12-01 10:44:39 +08:00 committed by techknowlogick
parent 7c6f2e27be
commit 2011a5b818
9 changed files with 130 additions and 53 deletions

View file

@ -116,7 +116,7 @@ func (issue *Issue) createCrossReferences(e *xorm.Session, ctx *crossReferencesC
if ctx.OrigComment != nil {
refCommentID = ctx.OrigComment.ID
}
if _, err := createComment(e, &CreateCommentOptions{
var opts = &CreateCommentOptions{
Type: ctx.Type,
Doer: ctx.Doer,
Repo: xref.Issue.Repo,
@ -126,7 +126,12 @@ func (issue *Issue) createCrossReferences(e *xorm.Session, ctx *crossReferencesC
RefCommentID: refCommentID,
RefAction: xref.Action,
RefIsPull: ctx.OrigIssue.IsPull,
}); err != nil {
}
comment, err := createCommentWithNoAction(e, opts)
if err != nil {
return err
}
if err = sendCreateCommentAction(e, opts, comment); err != nil {
return err
}
}