diff --git a/models/user/user.go b/models/user/user.go index 4aef30ca56..ff85c2cfa0 100644 --- a/models/user/user.go +++ b/models/user/user.go @@ -95,6 +95,7 @@ type User struct { Type UserType Location string Website string + Pronouns string Rands string `xorm:"VARCHAR(32)"` Salt string `xorm:"VARCHAR(32)"` Language string `xorm:"VARCHAR(5)"` diff --git a/modules/structs/admin_user.go b/modules/structs/admin_user.go index f7c6d10ba0..ad86f4ca03 100644 --- a/modules/structs/admin_user.go +++ b/modules/structs/admin_user.go @@ -41,6 +41,7 @@ type EditUserOption struct { MustChangePassword *bool `json:"must_change_password"` Website *string `json:"website" binding:"OmitEmpty;ValidUrl;MaxSize(255)"` Location *string `json:"location" binding:"MaxSize(50)"` + Pronouns *string `json:"pronouns" binding:"MaxSize(50)"` Description *string `json:"description" binding:"MaxSize(255)"` Active *bool `json:"active"` Admin *bool `json:"admin"` diff --git a/modules/structs/user.go b/modules/structs/user.go index 4e13669ad2..9e4858115c 100644 --- a/modules/structs/user.go +++ b/modules/structs/user.go @@ -87,6 +87,7 @@ type UserSettingsOptions struct { Website *string `json:"website" binding:"OmitEmpty;ValidUrl;MaxSize(255)"` Description *string `json:"description" binding:"MaxSize(255)"` Location *string `json:"location" binding:"MaxSize(50)"` + Pronouns *string `json:"pronouns" binding:"MaxSize(50)"` Language *string `json:"language"` Theme *string `json:"theme"` DiffViewStyle *string `json:"diff_view_style"` diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 3a871b2eb8..d099e78207 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -701,6 +701,7 @@ password_username_disabled = Non-local users are not allowed to change their use full_name = Full name website = Website location = Location +pronouns = Pronouns update_theme = Change theme update_profile = Update profile update_language = Change language diff --git a/routers/api/v1/admin/user.go b/routers/api/v1/admin/user.go index 87a5b28fad..12da8a9597 100644 --- a/routers/api/v1/admin/user.go +++ b/routers/api/v1/admin/user.go @@ -236,6 +236,7 @@ func EditUser(ctx *context.APIContext) { Website: optional.FromPtr(form.Website), Location: optional.FromPtr(form.Location), Description: optional.FromPtr(form.Description), + Pronouns: optional.FromPtr(form.Pronouns), IsActive: optional.FromPtr(form.Active), IsAdmin: optional.FromPtr(form.Admin), Visibility: optional.FromNonDefault(api.VisibilityModes[form.Visibility]), diff --git a/routers/api/v1/user/settings.go b/routers/api/v1/user/settings.go index f594eb211c..bfd24013db 100644 --- a/routers/api/v1/user/settings.go +++ b/routers/api/v1/user/settings.go @@ -48,6 +48,7 @@ func UpdateUserSettings(ctx *context.APIContext) { opts := &user_service.UpdateOptions{ FullName: optional.FromPtr(form.FullName), Description: optional.FromPtr(form.Description), + Pronouns: optional.FromPtr(form.Pronouns), Website: optional.FromPtr(form.Website), Location: optional.FromPtr(form.Location), Language: optional.FromPtr(form.Language), diff --git a/routers/web/user/setting/profile.go b/routers/web/user/setting/profile.go index 4e5c380ed9..b5d916b78f 100644 --- a/routers/web/user/setting/profile.go +++ b/routers/web/user/setting/profile.go @@ -90,6 +90,7 @@ func ProfilePost(ctx *context.Context) { FullName: optional.Some(form.FullName), KeepEmailPrivate: optional.Some(form.KeepEmailPrivate), Description: optional.Some(form.Description), + Pronouns: optional.Some(form.Pronouns), Website: optional.Some(form.Website), Location: optional.Some(form.Location), Visibility: optional.Some(form.Visibility), diff --git a/services/forms/user_form.go b/services/forms/user_form.go index 3290179092..196b092990 100644 --- a/services/forms/user_form.go +++ b/services/forms/user_form.go @@ -218,6 +218,7 @@ type UpdateProfileForm struct { KeepEmailPrivate bool Website string `binding:"ValidSiteUrl;MaxSize(255)"` Location string `binding:"MaxSize(50)"` + Pronouns string `binding:"MaxSize(50)"` Description string `binding:"MaxSize(255)"` Visibility structs.VisibleType KeepActivityPrivate bool diff --git a/services/user/update.go b/services/user/update.go index e96ab4274a..1bdbf13f0d 100644 --- a/services/user/update.go +++ b/services/user/update.go @@ -22,6 +22,7 @@ type UpdateOptions struct { Website optional.Option[string] Location optional.Option[string] Description optional.Option[string] + Pronouns optional.Option[string] AllowGitHook optional.Option[bool] AllowImportLocal optional.Option[bool] MaxRepoCreation optional.Option[int] @@ -54,6 +55,11 @@ func UpdateUser(ctx context.Context, u *user_model.User, opts *UpdateOptions) er cols = append(cols, "full_name") } + if opts.Pronouns.Has() { + u.Pronouns = opts.Pronouns.Value() + + cols = append(cols, "pronouns") + } if opts.Website.Has() { u.Website = opts.Website.Value() diff --git a/templates/shared/user/profile_big_avatar.tmpl b/templates/shared/user/profile_big_avatar.tmpl index bc7785629e..329a06d84d 100644 --- a/templates/shared/user/profile_big_avatar.tmpl +++ b/templates/shared/user/profile_big_avatar.tmpl @@ -13,7 +13,7 @@