From 053592d8471fc869e4c9440910193fe7e89b4a41 Mon Sep 17 00:00:00 2001 From: TheFox0x7 Date: Thu, 27 Mar 2025 14:16:17 +0100 Subject: [PATCH] fix org repo creation being limited by user limits (#34030) fixes an issue where user is unable to create new repository in organization via UI if repository limits are in place and user has exhausted them for their own namespace. closes: https://github.com/go-gitea/gitea/issues/15504 --------- Co-authored-by: wxiaoguang --- routers/web/repo/repo.go | 4 ++-- templates/repo/create.tmpl | 24 +++++++++------------ tests/integration/repo_generate_test.go | 8 +++---- web_src/js/features/repo-new.ts | 28 ++++++++++++++++++------- 4 files changed, 37 insertions(+), 27 deletions(-) diff --git a/routers/web/repo/repo.go b/routers/web/repo/repo.go index 73baf683ed5..54b7448a898 100644 --- a/routers/web/repo/repo.go +++ b/routers/web/repo/repo.go @@ -154,8 +154,8 @@ func createCommon(ctx *context.Context) { ctx.Data["Licenses"] = repo_module.Licenses ctx.Data["Readmes"] = repo_module.Readmes ctx.Data["IsForcedPrivate"] = setting.Repository.ForcePrivate - ctx.Data["CanCreateRepo"] = ctx.Doer.CanCreateRepo() - ctx.Data["MaxCreationLimit"] = ctx.Doer.MaxCreationLimit() + ctx.Data["CanCreateRepoInDoer"] = ctx.Doer.CanCreateRepo() + ctx.Data["MaxCreationLimitOfDoer"] = ctx.Doer.MaxCreationLimit() ctx.Data["SupportedObjectFormats"] = git.DefaultFeatures().SupportedObjectFormats ctx.Data["DefaultObjectFormat"] = git.Sha1ObjectFormat } diff --git a/templates/repo/create.tmpl b/templates/repo/create.tmpl index ad308c857cb..a90c26b423b 100644 --- a/templates/repo/create.tmpl +++ b/templates/repo/create.tmpl @@ -7,25 +7,21 @@
{{template "base/alert" .}} {{template "repo/create_helper" .}} - - {{if not .CanCreateRepo}} -
-

{{ctx.Locale.TrN .MaxCreationLimit "repo.form.reach_limit_of_creation_1" "repo.form.reach_limit_of_creation_n" .MaxCreationLimit}}

-
- {{end}}
{{.CsrfTokenHtml}} +
-