From 6aba69ce8565179b46d73d1ba23d8d4ad16c4557 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Thu, 29 Feb 2024 13:55:52 +0100 Subject: [PATCH] Enable user pronoun editing from the admin ui While users can edit their own pronouns, the admin UI enables an admin to edit *any* user setting. As such, pronouns should be editable here, too. For the sake of simplicity, the input here is a simple text input field, rather than a dropdown. Signed-off-by: Gergely Nagy --- routers/web/admin/users.go | 1 + services/forms/admin.go | 1 + templates/admin/user/edit.tmpl | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/routers/web/admin/users.go b/routers/web/admin/users.go index b93668c5a2..3dcf0d2aa8 100644 --- a/routers/web/admin/users.go +++ b/routers/web/admin/users.go @@ -435,6 +435,7 @@ func EditUserPost(ctx *context.Context) { FullName: optional.Some(form.FullName), Website: optional.Some(form.Website), Location: optional.Some(form.Location), + Pronouns: optional.Some(form.Pronouns), IsActive: optional.Some(form.Active), IsAdmin: optional.Some(form.Admin), AllowGitHook: optional.Some(form.AllowGitHook), diff --git a/services/forms/admin.go b/services/forms/admin.go index 81276f8f46..7d46904440 100644 --- a/services/forms/admin.go +++ b/services/forms/admin.go @@ -42,6 +42,7 @@ type AdminEditUserForm struct { Website string `binding:"ValidUrl;MaxSize(255)"` Location string `binding:"MaxSize(50)"` Language string `binding:"MaxSize(5)"` + Pronouns string `binding:"MaxSize(50)"` MaxRepoCreation int Active bool Admin bool diff --git a/templates/admin/user/edit.tmpl b/templates/admin/user/edit.tmpl index 41b00defb4..8203a2a076 100644 --- a/templates/admin/user/edit.tmpl +++ b/templates/admin/user/edit.tmpl @@ -61,6 +61,10 @@ +
+ + +