From 8b3dd7de5dac3eb621b3dc3a0e2cf22cd8e840d8 Mon Sep 17 00:00:00 2001 From: Giteabot Date: Fri, 31 Mar 2023 04:25:21 -0400 Subject: [PATCH] Fix incorrect visibility dropdown list in add/edit user page (#23804) (#23833) Backport #23804 by @yp05327 Visibility dropdown list will not work in add/edit user page when error occurred Co-authored-by: yp05327 <576951401@qq.com> --- routers/web/admin/users.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/routers/web/admin/users.go b/routers/web/admin/users.go index 1bb9d04806..5fb2a3e5d6 100644 --- a/routers/web/admin/users.go +++ b/routers/web/admin/users.go @@ -105,6 +105,7 @@ func NewUserPost(ctx *context.Context) { ctx.Data["PageIsAdmin"] = true ctx.Data["PageIsAdminUsers"] = true ctx.Data["DefaultUserVisibilityMode"] = setting.Service.DefaultUserVisibilityMode + ctx.Data["AllowedUserVisibilityModes"] = setting.Service.AllowedUserVisibilityModesSlice.ToVisibleTypeSlice() sources, err := auth.Sources() if err != nil { @@ -273,6 +274,7 @@ func EditUserPost(ctx *context.Context) { ctx.Data["PageIsAdmin"] = true ctx.Data["PageIsAdminUsers"] = true ctx.Data["DisableMigrations"] = setting.Repository.DisableMigrations + ctx.Data["AllowedUserVisibilityModes"] = setting.Service.AllowedUserVisibilityModesSlice.ToVisibleTypeSlice() u := prepareUserInfo(ctx) if ctx.Written() {