1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-08-02 16:35:19 +02:00

Use for a repo action one database transaction (#19576)

... more context

(part of #9307)
This commit is contained in:
6543 2022-05-03 21:46:28 +02:00 committed by GitHub
parent 730420b6b3
commit 92f139d091
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 270 additions and 260 deletions

View file

@ -5,6 +5,8 @@
package models
import (
"context"
"code.gitea.io/gitea/models/db"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/timeutil"
@ -117,12 +119,8 @@ func issueDepExists(e db.Engine, issueID, depID int64) (bool, error) {
}
// IssueNoDependenciesLeft checks if issue can be closed
func IssueNoDependenciesLeft(issue *Issue) (bool, error) {
return issueNoDependenciesLeft(db.GetEngine(db.DefaultContext), issue)
}
func issueNoDependenciesLeft(e db.Engine, issue *Issue) (bool, error) {
exists, err := e.
func IssueNoDependenciesLeft(ctx context.Context, issue *Issue) (bool, error) {
exists, err := db.GetEngine(ctx).
Table("issue_dependency").
Select("issue.*").
Join("INNER", "issue", "issue.id = issue_dependency.dependency_id").