mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-01 17:38:33 +00:00
[v7.0/forgejo] Add optional pronoun field in user settings (#3076)
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/1518 An attempt at adding an optional pronoun field for user profiles, as suggested here 3 years ago: https://github.com/go-gitea/gitea/issues/13990  I made this for [my own instance](https://git.gay/h) and didn't initially think I'd make a PR because of the previous closed issue, but I thought I'd ask the Forgejo matrix chat to see if there was any support and there was! I'm told I should make a database migration, some help as to how to do that would be appreciated. Co-authored-by: hazycora <hazysu@riseup.net> Co-authored-by: Gergely Nagy <forgejo@gergo.csillger.hu> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3076 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Co-authored-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org> Co-committed-by: forgejo-backport-action <forgejo-backport-action@noreply.codeberg.org>
This commit is contained in:
parent
a070f28c81
commit
5bde9555b1
21 changed files with 331 additions and 1 deletions
|
@ -56,6 +56,7 @@ func toUser(ctx context.Context, user *user_model.User, signed, authed bool) *ap
|
|||
Created: user.CreatedUnix.AsTime(),
|
||||
Restricted: user.IsRestricted,
|
||||
Location: user.Location,
|
||||
Pronouns: user.Pronouns,
|
||||
Website: user.Website,
|
||||
Description: user.Description,
|
||||
// counter's
|
||||
|
@ -89,6 +90,7 @@ func User2UserSettings(user *user_model.User) api.UserSettings {
|
|||
FullName: user.FullName,
|
||||
Website: user.Website,
|
||||
Location: user.Location,
|
||||
Pronouns: user.Pronouns,
|
||||
Language: user.Language,
|
||||
Description: user.Description,
|
||||
Theme: user.Theme,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue