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>
This commit is contained in:
Giteabot 2023-03-31 04:25:21 -04:00 committed by GitHub
parent a04535e212
commit 8b3dd7de5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -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() {