summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-12-10 12:46:05 -0500
committerUnknwon <u@gogs.io>2015-12-10 12:46:05 -0500
commitdf5ed64cca97919739ef20abf463fb3f211595fa (patch)
treeafbf8b0a06d619c1e808941823338269e1f7eff6 /models
parent2a0bb1fa906a4d135ed88de4f705c3ab7214e60c (diff)
downloadgitea-df5ed64cca97919739ef20abf463fb3f211595fa.tar.gz
gitea-df5ed64cca97919739ef20abf463fb3f211595fa.zip
#1301 "read-only" users
Diffstat (limited to 'models')
-rw-r--r--models/user.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/models/user.go b/models/user.go
index 3ff525c589..6411bee6fd 100644
--- a/models/user.go
+++ b/models/user.go
@@ -104,8 +104,8 @@ type User struct {
}
func (u *User) BeforeUpdate() {
- if u.MaxRepoCreation < 0 {
- u.MaxRepoCreation = 0
+ if u.MaxRepoCreation < -1 {
+ u.MaxRepoCreation = -1
}
}
@@ -125,14 +125,14 @@ func (u *User) HasForkedRepo(repoID int64) bool {
}
func (u *User) RepoCreationNum() int {
- if u.MaxRepoCreation == 0 {
+ if u.MaxRepoCreation <= -1 {
return setting.Repository.MaxCreationLimit
}
return u.MaxRepoCreation
}
func (u *User) CanCreateRepo() bool {
- if u.MaxRepoCreation == 0 {
+ if u.MaxRepoCreation <= -1 {
return u.NumRepos < setting.Repository.MaxCreationLimit
}
return u.NumRepos < u.MaxRepoCreation