mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-25 11:22:16 +00:00
Move attachment into models/repo/ (#17650)
* Move attachment into models/repo/ * Fix test * Fix bug
This commit is contained in:
parent
7a03473159
commit
fc3d082609
39 changed files with 477 additions and 414 deletions
|
@ -37,13 +37,13 @@ func updateIssueLock(opts *IssueLockOptions, lock bool) error {
|
|||
commentType = CommentTypeUnlock
|
||||
}
|
||||
|
||||
sess := db.NewSession(db.DefaultContext)
|
||||
defer sess.Close()
|
||||
if err := sess.Begin(); err != nil {
|
||||
ctx, committer, err := db.TxContext()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer committer.Close()
|
||||
|
||||
if err := updateIssueCols(sess, opts.Issue, "is_locked"); err != nil {
|
||||
if err := updateIssueCols(db.GetEngine(ctx), opts.Issue, "is_locked"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -54,9 +54,9 @@ func updateIssueLock(opts *IssueLockOptions, lock bool) error {
|
|||
Type: commentType,
|
||||
Content: opts.Reason,
|
||||
}
|
||||
if _, err := createComment(sess, opt); err != nil {
|
||||
if _, err := createComment(ctx, opt); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return sess.Commit()
|
||||
return committer.Commit()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue