Skip to content

Commit

Permalink
Use correct user when determining max repo limits for error messages (g…
Browse files Browse the repository at this point in the history
…o-gitea#18153)

- Use the correct user(`owner` instead of `ctx.User`) to get the maxCreationLimit.
  • Loading branch information
Gusted authored and Stelios Malathouras committed Mar 28, 2022
1 parent d5fb200 commit 217dbb5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion routers/web/repo/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func handleMigrateError(ctx *context.Context, owner *user_model.User, err error,
ctx.RenderWithErr(ctx.Tr("form.2fa_auth_required"), tpl, form)
case repo_model.IsErrReachLimitOfRepo(err):
var msg string
maxCreationLimit := ctx.User.MaxCreationLimit()
maxCreationLimit := owner.MaxCreationLimit()
if maxCreationLimit == 1 {
msg = ctx.Tr("repo.form.reach_limit_of_creation_1", maxCreationLimit)
} else {
Expand Down
2 changes: 1 addition & 1 deletion routers/web/repo/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func handleCreateError(ctx *context.Context, owner *user_model.User, err error,
switch {
case repo_model.IsErrReachLimitOfRepo(err):
var msg string
maxCreationLimit := ctx.User.MaxCreationLimit()
maxCreationLimit := owner.MaxCreationLimit()
if maxCreationLimit == 1 {
msg = ctx.Tr("repo.form.reach_limit_of_creation_1", maxCreationLimit)
} else {
Expand Down
2 changes: 1 addition & 1 deletion routers/web/repo/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ func SettingsPost(ctx *context.Context) {
}

if !ctx.Repo.Owner.CanCreateRepo() {
maxCreationLimit := ctx.User.MaxCreationLimit()
maxCreationLimit := ctx.Repo.Owner.MaxCreationLimit()
if maxCreationLimit == 1 {
ctx.Flash.Error(ctx.Tr("repo.form.reach_limit_of_creation_1", maxCreationLimit))
} else {
Expand Down

0 comments on commit 217dbb5

Please sign in to comment.