From 92f139d091c906cc6d30599101d45c62a208f585 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Tue, 3 May 2022 21:46:28 +0200 Subject: Use for a repo action one database transaction (#19576) ... more context (part of #9307) --- models/issue_dependency.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'models/issue_dependency.go') 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"). -- cgit v1.2.3