diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2018-10-25 18:55:16 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-25 18:55:16 +0800 |
commit | 5f938c0c7870a112aa9ab65b6f4fd1f47eb34f51 (patch) | |
tree | 517927f7777d3aad8ff97c798ab8a6520d714559 /models/repo.go | |
parent | 554581f84855eda4589a4f66bb560a5ca00e63ff (diff) | |
download | gitea-5f938c0c7870a112aa9ab65b6f4fd1f47eb34f51.tar.gz gitea-5f938c0c7870a112aa9ab65b6f4fd1f47eb34f51.zip |
Fix sqlite lock (#5176)
* fix sqlite lock
* fix sqlite lock on getUnitType
Diffstat (limited to 'models/repo.go')
-rw-r--r-- | models/repo.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/models/repo.go b/models/repo.go index 15b6156508..61e1e26ae7 100644 --- a/models/repo.go +++ b/models/repo.go @@ -321,7 +321,11 @@ func (repo *Repository) getUnits(e Engine) (err error) { // CheckUnitUser check whether user could visit the unit of this repository func (repo *Repository) CheckUnitUser(userID int64, isAdmin bool, unitType UnitType) bool { - if err := repo.getUnitsByUserID(x, userID, isAdmin); err != nil { + return repo.checkUnitUser(x, userID, isAdmin, unitType) +} + +func (repo *Repository) checkUnitUser(e Engine, userID int64, isAdmin bool, unitType UnitType) bool { + if err := repo.getUnitsByUserID(e, userID, isAdmin); err != nil { return false } @@ -369,7 +373,7 @@ func (repo *Repository) getUnitsByUserID(e Engine, userID int64, isAdmin bool) ( var newRepoUnits = make([]*RepoUnit, 0, len(repo.Units)) for _, u := range repo.Units { for _, team := range teams { - if team.UnitEnabled(u.Type) { + if team.unitEnabled(e, u.Type) { newRepoUnits = append(newRepoUnits, u) break } |