Rename RepoCreationNum -> MaxCreationLimit (#1766)

tokarchuk/v1.17
Jonas Östanbäck 8 years ago committed by Lunny Xiao
parent de39d09caa
commit 7b907ed348
  1. 4
      models/user.go
  2. 2
      routers/repo/repo.go

@ -211,8 +211,8 @@ func (u *User) HasForkedRepo(repoID int64) bool {
return has return has
} }
// RepoCreationNum returns the number of repositories created by the user // MaxCreationLimit returns the number of repositories a user is allowed to create
func (u *User) RepoCreationNum() int { func (u *User) MaxCreationLimit() int {
if u.MaxRepoCreation <= -1 { if u.MaxRepoCreation <= -1 {
return setting.Repository.MaxCreationLimit return setting.Repository.MaxCreationLimit
} }

@ -93,7 +93,7 @@ func Create(ctx *context.Context) {
func handleCreateError(ctx *context.Context, owner *models.User, err error, name string, tpl base.TplName, form interface{}) { func handleCreateError(ctx *context.Context, owner *models.User, err error, name string, tpl base.TplName, form interface{}) {
switch { switch {
case models.IsErrReachLimitOfRepo(err): case models.IsErrReachLimitOfRepo(err):
ctx.RenderWithErr(ctx.Tr("repo.form.reach_limit_of_creation", owner.RepoCreationNum()), tpl, form) ctx.RenderWithErr(ctx.Tr("repo.form.reach_limit_of_creation", owner.MaxCreationLimit()), tpl, form)
case models.IsErrRepoAlreadyExist(err): case models.IsErrRepoAlreadyExist(err):
ctx.Data["Err_RepoName"] = true ctx.Data["Err_RepoName"] = true
ctx.RenderWithErr(ctx.Tr("form.repo_name_been_taken"), tpl, form) ctx.RenderWithErr(ctx.Tr("form.repo_name_been_taken"), tpl, form)

Loading…
Cancel
Save