Skip to content

Commit 88da7a7

Browse files
author
Gusted
authored
Use correct user when determining max repo limits for error messages (#18153)
- Use the correct user(`owner` instead of `ctx.User`) to get the maxCreationLimit.
1 parent 5d4ee44 commit 88da7a7

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

routers/web/repo/migrate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func handleMigrateError(ctx *context.Context, owner *user_model.User, err error,
8282
ctx.RenderWithErr(ctx.Tr("form.2fa_auth_required"), tpl, form)
8383
case repo_model.IsErrReachLimitOfRepo(err):
8484
var msg string
85-
maxCreationLimit := ctx.User.MaxCreationLimit()
85+
maxCreationLimit := owner.MaxCreationLimit()
8686
if maxCreationLimit == 1 {
8787
msg = ctx.Tr("repo.form.reach_limit_of_creation_1", maxCreationLimit)
8888
} else {

routers/web/repo/repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func handleCreateError(ctx *context.Context, owner *user_model.User, err error,
163163
switch {
164164
case repo_model.IsErrReachLimitOfRepo(err):
165165
var msg string
166-
maxCreationLimit := ctx.User.MaxCreationLimit()
166+
maxCreationLimit := owner.MaxCreationLimit()
167167
if maxCreationLimit == 1 {
168168
msg = ctx.Tr("repo.form.reach_limit_of_creation_1", maxCreationLimit)
169169
} else {

routers/web/repo/setting.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ func SettingsPost(ctx *context.Context) {
609609
}
610610

611611
if !ctx.Repo.Owner.CanCreateRepo() {
612-
maxCreationLimit := ctx.User.MaxCreationLimit()
612+
maxCreationLimit := ctx.Repo.Owner.MaxCreationLimit()
613613
if maxCreationLimit == 1 {
614614
ctx.Flash.Error(ctx.Tr("repo.form.reach_limit_of_creation_1", maxCreationLimit))
615615
} else {

0 commit comments

Comments
 (0)