@ -15,26 +15,6 @@ import (
"code.gitea.io/gitea/modules/timeutil"
)
// CreateComment creates comment of issue or commit.
func CreateComment ( ctx context . Context , opts * issues_model . CreateCommentOptions ) ( comment * issues_model . Comment , err error ) {
ctx , committer , err := db . TxContext ( ctx )
if err != nil {
return nil , err
}
defer committer . Close ( )
comment , err = issues_model . CreateComment ( ctx , opts )
if err != nil {
return nil , err
}
if err = committer . Commit ( ) ; err != nil {
return nil , err
}
return comment , nil
}
// CreateRefComment creates a commit reference comment to issue.
func CreateRefComment ( ctx context . Context , doer * user_model . User , repo * repo_model . Repository , issue * issues_model . Issue , content , commitSHA string ) error {
if len ( commitSHA ) == 0 {
@ -53,7 +33,7 @@ func CreateRefComment(ctx context.Context, doer *user_model.User, repo *repo_mod
return nil
}
_ , err = CreateComment ( ctx , & issues_model . CreateCommentOptions {
_ , err = issues_model . CreateComment ( ctx , & issues_model . CreateCommentOptions {
Type : issues_model . CommentTypeCommitRef ,
Doer : doer ,
Repo : repo ,
@ -66,7 +46,7 @@ func CreateRefComment(ctx context.Context, doer *user_model.User, repo *repo_mod
// CreateIssueComment creates a plain issue comment.
func CreateIssueComment ( ctx context . Context , doer * user_model . User , repo * repo_model . Repository , issue * issues_model . Issue , content string , attachments [ ] string ) ( * issues_model . Comment , error ) {
comment , err := CreateComment ( ctx , & issues_model . CreateCommentOptions {
comment , err := issues_model . CreateComment ( ctx , & issues_model . CreateCommentOptions {
Type : issues_model . CommentTypeComment ,
Doer : doer ,
Repo : repo ,