diff options
author | 6543 <6543@obermui.de> | 2022-05-03 21:46:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-03 21:46:28 +0200 |
commit | 92f139d091c906cc6d30599101d45c62a208f585 (patch) | |
tree | e7be0dfc3cd9ae0611bd7cfa11cc1ee277e756fd /models/issue_dependency.go | |
parent | 730420b6b32414db7fcd12ede87712b0f960de7b (diff) | |
download | gitea-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_dependency.go')
-rw-r--r-- | models/issue_dependency.go | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/models/issue_dependency.go b/models/issue_dependency.go index d2c5785b90..b292db57e0 100644 --- a/models/issue_dependency.go +++ b/models/issue_dependency.go @@ -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"). |