1
1
mirror of https://github.com/go-gitea/gitea synced 2025-01-09 09:24:25 +00:00

Add transaction for CloseIssue

This commit is contained in:
Lunny Xiao 2024-11-10 13:45:31 -08:00
parent fdff19948a
commit 6fe35175a7
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A

View File

@ -127,7 +127,20 @@ func CloseIssue(ctx context.Context, issue *Issue, doer *user_model.User) (*Comm
return nil, err
}
return changeIssueStatus(ctx, issue, doer, true, false)
ctx, committer, err := db.TxContext(ctx)
if err != nil {
return nil, err
}
defer committer.Close()
comment, err := changeIssueStatus(ctx, issue, doer, true, false)
if err != nil {
return nil, err
}
if err := committer.Commit(); err != nil {
return nil, err
}
return comment, nil
}
// ChangeIssueStatus changes issue status to open or closed.