mirror of
https://github.com/go-gitea/gitea.git
synced 2024-12-27 10:20:48 +08:00
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.
This commit is contained in:
parent
5d4ee44ed3
commit
88da7a7174
@ -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)
|
ctx.RenderWithErr(ctx.Tr("form.2fa_auth_required"), tpl, form)
|
||||||
case repo_model.IsErrReachLimitOfRepo(err):
|
case repo_model.IsErrReachLimitOfRepo(err):
|
||||||
var msg string
|
var msg string
|
||||||
maxCreationLimit := ctx.User.MaxCreationLimit()
|
maxCreationLimit := owner.MaxCreationLimit()
|
||||||
if maxCreationLimit == 1 {
|
if maxCreationLimit == 1 {
|
||||||
msg = ctx.Tr("repo.form.reach_limit_of_creation_1", maxCreationLimit)
|
msg = ctx.Tr("repo.form.reach_limit_of_creation_1", maxCreationLimit)
|
||||||
} else {
|
} else {
|
||||||
|
@ -163,7 +163,7 @@ func handleCreateError(ctx *context.Context, owner *user_model.User, err error,
|
|||||||
switch {
|
switch {
|
||||||
case repo_model.IsErrReachLimitOfRepo(err):
|
case repo_model.IsErrReachLimitOfRepo(err):
|
||||||
var msg string
|
var msg string
|
||||||
maxCreationLimit := ctx.User.MaxCreationLimit()
|
maxCreationLimit := owner.MaxCreationLimit()
|
||||||
if maxCreationLimit == 1 {
|
if maxCreationLimit == 1 {
|
||||||
msg = ctx.Tr("repo.form.reach_limit_of_creation_1", maxCreationLimit)
|
msg = ctx.Tr("repo.form.reach_limit_of_creation_1", maxCreationLimit)
|
||||||
} else {
|
} else {
|
||||||
|
@ -609,7 +609,7 @@ func SettingsPost(ctx *context.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !ctx.Repo.Owner.CanCreateRepo() {
|
if !ctx.Repo.Owner.CanCreateRepo() {
|
||||||
maxCreationLimit := ctx.User.MaxCreationLimit()
|
maxCreationLimit := ctx.Repo.Owner.MaxCreationLimit()
|
||||||
if maxCreationLimit == 1 {
|
if maxCreationLimit == 1 {
|
||||||
ctx.Flash.Error(ctx.Tr("repo.form.reach_limit_of_creation_1", maxCreationLimit))
|
ctx.Flash.Error(ctx.Tr("repo.form.reach_limit_of_creation_1", maxCreationLimit))
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user