From 18a673bad1d036502baca4491a16679692c42320 Mon Sep 17 00:00:00 2001 From: bytedream <63594396+bytedream@users.noreply.github.com> Date: Tue, 15 Apr 2025 10:21:51 +0200 Subject: [PATCH] Restore form inputs on organization create error (#34201) Keeps the entered inputs when the "organization create" request returns an error. Co-authored-by: wxiaoguang --- routers/web/org/org.go | 5 ++++- templates/org/create.tmpl | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/routers/web/org/org.go b/routers/web/org/org.go index 856a605764..0540d5c591 100644 --- a/routers/web/org/org.go +++ b/routers/web/org/org.go @@ -27,11 +27,14 @@ const ( // Create render the page for create organization func Create(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("new_org") - ctx.Data["DefaultOrgVisibilityMode"] = setting.Service.DefaultOrgVisibilityMode if !ctx.Doer.CanCreateOrganization() { ctx.ServerError("Not allowed", errors.New(ctx.Locale.TrString("org.form.create_org_not_allowed"))) return } + + ctx.Data["visibility"] = setting.Service.DefaultOrgVisibilityMode + ctx.Data["repo_admin_change_team_access"] = true + ctx.HTML(http.StatusOK, tplCreateOrg) } diff --git a/templates/org/create.tmpl b/templates/org/create.tmpl index 7934d5b722..2d6dca5440 100644 --- a/templates/org/create.tmpl +++ b/templates/org/create.tmpl @@ -18,15 +18,15 @@
- +
- +
- +
@@ -35,7 +35,7 @@
- +