summaryrefslogtreecommitdiffstats
path: root/models/repo_permission.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2020-01-12 17:36:21 +0800
committerGitHub <noreply@github.com>2020-01-12 17:36:21 +0800
commit5765212c6dbcaeb27779707af3ca57775e535bd9 (patch)
treed3cf5fcedf21486e3b26731ba93cebd8ee13532b /models/repo_permission.go
parent65baacf2273f74876b3faed93f60641389a20d39 (diff)
downloadgitea-5765212c6dbcaeb27779707af3ca57775e535bd9.tar.gz
gitea-5765212c6dbcaeb27779707af3ca57775e535bd9.zip
Add owner_name column for table repository for maintaince reason (#9717)
* Add owner_name column for table repository for maintaince reason * refactor * Fix tests * fix test * fix bug when fork repository Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'models/repo_permission.go')
-rw-r--r--models/repo_permission.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/models/repo_permission.go b/models/repo_permission.go
index 374c6f8d56..cd20224912 100644
--- a/models/repo_permission.go
+++ b/models/repo_permission.go
@@ -164,10 +164,6 @@ func getUserRepoPermission(e Engine, repo *Repository, user *User) (perm Permiss
return
}
- if repo.Owner == nil {
- repo.mustOwner(e)
- }
-
var isCollaborator bool
if user != nil {
isCollaborator, err = repo.isCollaborator(e, user.ID)
@@ -176,6 +172,10 @@ func getUserRepoPermission(e Engine, repo *Repository, user *User) (perm Permiss
}
}
+ if err = repo.getOwner(e); err != nil {
+ return
+ }
+
// Prevent strangers from checking out public repo of private orginization
// Allow user if they are collaborator of a repo within a private orginization but not a member of the orginization itself
if repo.Owner.IsOrganization() && !HasOrgVisible(repo.Owner, user) && !isCollaborator {