aboutsummaryrefslogtreecommitdiffstats
path: root/models/project_issue.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-11-21 23:41:00 +0800
committerGitHub <noreply@github.com>2021-11-21 23:41:00 +0800
commitd710af6669654f27f02b69d7ef1ba563e7d58a90 (patch)
tree9727f468a570106293dc90beb70035180bbb7e8e /models/project_issue.go
parent0add627182388ac63fd04b94cdf912fb87fd0326 (diff)
downloadgitea-d710af6669654f27f02b69d7ef1ba563e7d58a90.tar.gz
gitea-d710af6669654f27f02b69d7ef1ba563e7d58a90.zip
Remove NewSession method from db.Engine interface (#17577)
* Remove NewSession method from db.Engine interface * Fix bug * Some improvements * Fix bug * Fix test * Use XXXBean instead of XXXExample
Diffstat (limited to 'models/project_issue.go')
-rw-r--r--models/project_issue.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/models/project_issue.go b/models/project_issue.go
index 75e74295b5..6f314ca931 100644
--- a/models/project_issue.go
+++ b/models/project_issue.go
@@ -185,11 +185,12 @@ func addUpdateIssueProject(ctx context.Context, issue *Issue, doer *User, newPro
// MoveIssueAcrossProjectBoards move a card from one board to another
func MoveIssueAcrossProjectBoards(issue *Issue, board *ProjectBoard) error {
- 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()
+ sess := db.GetEngine(ctx)
var pis ProjectIssue
has, err := sess.Where("issue_id=?", issue.ID).Get(&pis)
@@ -206,7 +207,7 @@ func MoveIssueAcrossProjectBoards(issue *Issue, board *ProjectBoard) error {
return err
}
- return sess.Commit()
+ return committer.Commit()
}
func (pb *ProjectBoard) removeIssues(e db.Engine) error {