aboutsummaryrefslogtreecommitdiffstats
path: root/models/issue_dependency.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2018-10-27 22:45:24 +0800
committerGitHub <noreply@github.com>2018-10-27 22:45:24 +0800
commit2b7c366f6489787aecff307732fb3ddfeed1915f (patch)
treebc9de66914ef7076e9cceb0733e1935d0d506e6b /models/issue_dependency.go
parent99c09dfbfa818c753459e90db5ff12a323d2936f (diff)
downloadgitea-2b7c366f6489787aecff307732fb3ddfeed1915f.tar.gz
gitea-2b7c366f6489787aecff307732fb3ddfeed1915f.zip
fix sqlite lock (#5184)
* fix sqlite lock * fix bug Co-Authored-By: lunny <xiaolunwen@gmail.com> * fix bug Co-Authored-By: lunny <xiaolunwen@gmail.com>
Diffstat (limited to 'models/issue_dependency.go')
-rw-r--r--models/issue_dependency.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/models/issue_dependency.go b/models/issue_dependency.go
index 157e9257c4..ffa972c106 100644
--- a/models/issue_dependency.go
+++ b/models/issue_dependency.go
@@ -113,8 +113,11 @@ func issueDepExists(e Engine, issueID int64, depID int64) (bool, error) {
// IssueNoDependenciesLeft checks if issue can be closed
func IssueNoDependenciesLeft(issue *Issue) (bool, error) {
+ return issueNoDependenciesLeft(x, issue)
+}
- exists, err := x.
+func issueNoDependenciesLeft(e Engine, issue *Issue) (bool, error) {
+ exists, err := e.
Table("issue_dependency").
Select("issue.*").
Join("INNER", "issue", "issue.id = issue_dependency.dependency_id").
@@ -127,9 +130,13 @@ func IssueNoDependenciesLeft(issue *Issue) (bool, error) {
// IsDependenciesEnabled returns if dependecies are enabled and returns the default setting if not set.
func (repo *Repository) IsDependenciesEnabled() bool {
+ return repo.isDependenciesEnabled(x)
+}
+
+func (repo *Repository) isDependenciesEnabled(e Engine) bool {
var u *RepoUnit
var err error
- if u, err = repo.GetUnit(UnitTypeIssues); err != nil {
+ if u, err = repo.getUnit(e, UnitTypeIssues); err != nil {
log.Trace("%s", err)
return setting.Service.DefaultEnableDependencies
}