aboutsummaryrefslogtreecommitdiffstats
path: root/models/issue_comment.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2022-05-03 21:46:28 +0200
committerGitHub <noreply@github.com>2022-05-03 21:46:28 +0200
commit92f139d091c906cc6d30599101d45c62a208f585 (patch)
treee7be0dfc3cd9ae0611bd7cfa11cc1ee277e756fd /models/issue_comment.go
parent730420b6b32414db7fcd12ede87712b0f960de7b (diff)
downloadgitea-92f139d091c906cc6d30599101d45c62a208f585.tar.gz
gitea-92f139d091c906cc6d30599101d45c62a208f585.zip
Use for a repo action one database transaction (#19576)
... more context (part of #9307)
Diffstat (limited to 'models/issue_comment.go')
-rw-r--r--models/issue_comment.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/models/issue_comment.go b/models/issue_comment.go
index 39c2818eed..ceea878662 100644
--- a/models/issue_comment.go
+++ b/models/issue_comment.go
@@ -284,14 +284,15 @@ type PushActionContent struct {
// LoadIssue loads issue from database
func (c *Comment) LoadIssue() (err error) {
- return c.loadIssue(db.GetEngine(db.DefaultContext))
+ return c.LoadIssueCtx(db.DefaultContext)
}
-func (c *Comment) loadIssue(e db.Engine) (err error) {
+// LoadIssueCtx loads issue from database
+func (c *Comment) LoadIssueCtx(ctx context.Context) (err error) {
if c.Issue != nil {
return nil
}
- c.Issue, err = getIssueByID(e, c.IssueID)
+ c.Issue, err = getIssueByID(db.GetEngine(ctx), c.IssueID)
return
}
@@ -1126,7 +1127,7 @@ func UpdateComment(c *Comment, doer *user_model.User) error {
if _, err := sess.ID(c.ID).AllCols().Update(c); err != nil {
return err
}
- if err := c.loadIssue(sess); err != nil {
+ if err := c.LoadIssueCtx(ctx); err != nil {
return err
}
if err := c.addCrossReferences(ctx, doer, true); err != nil {