mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-22 05:36:16 +00:00
add pronoun field to user profiles
This commit is contained in:
parent
efd0f0f224
commit
f8e48e066a
|
@ -95,6 +95,7 @@ type User struct {
|
||||||
Type UserType
|
Type UserType
|
||||||
Location string
|
Location string
|
||||||
Website string
|
Website string
|
||||||
|
Pronouns string
|
||||||
Rands string `xorm:"VARCHAR(32)"`
|
Rands string `xorm:"VARCHAR(32)"`
|
||||||
Salt string `xorm:"VARCHAR(32)"`
|
Salt string `xorm:"VARCHAR(32)"`
|
||||||
Language string `xorm:"VARCHAR(5)"`
|
Language string `xorm:"VARCHAR(5)"`
|
||||||
|
|
|
@ -41,6 +41,7 @@ type EditUserOption struct {
|
||||||
MustChangePassword *bool `json:"must_change_password"`
|
MustChangePassword *bool `json:"must_change_password"`
|
||||||
Website *string `json:"website" binding:"OmitEmpty;ValidUrl;MaxSize(255)"`
|
Website *string `json:"website" binding:"OmitEmpty;ValidUrl;MaxSize(255)"`
|
||||||
Location *string `json:"location" binding:"MaxSize(50)"`
|
Location *string `json:"location" binding:"MaxSize(50)"`
|
||||||
|
Pronouns *string `json:"pronouns" binding:"MaxSize(50)"`
|
||||||
Description *string `json:"description" binding:"MaxSize(255)"`
|
Description *string `json:"description" binding:"MaxSize(255)"`
|
||||||
Active *bool `json:"active"`
|
Active *bool `json:"active"`
|
||||||
Admin *bool `json:"admin"`
|
Admin *bool `json:"admin"`
|
||||||
|
|
|
@ -87,6 +87,7 @@ type UserSettingsOptions struct {
|
||||||
Website *string `json:"website" binding:"OmitEmpty;ValidUrl;MaxSize(255)"`
|
Website *string `json:"website" binding:"OmitEmpty;ValidUrl;MaxSize(255)"`
|
||||||
Description *string `json:"description" binding:"MaxSize(255)"`
|
Description *string `json:"description" binding:"MaxSize(255)"`
|
||||||
Location *string `json:"location" binding:"MaxSize(50)"`
|
Location *string `json:"location" binding:"MaxSize(50)"`
|
||||||
|
Pronouns *string `json:"pronouns" binding:"MaxSize(50)"`
|
||||||
Language *string `json:"language"`
|
Language *string `json:"language"`
|
||||||
Theme *string `json:"theme"`
|
Theme *string `json:"theme"`
|
||||||
DiffViewStyle *string `json:"diff_view_style"`
|
DiffViewStyle *string `json:"diff_view_style"`
|
||||||
|
|
|
@ -701,6 +701,7 @@ password_username_disabled = Non-local users are not allowed to change their use
|
||||||
full_name = Full name
|
full_name = Full name
|
||||||
website = Website
|
website = Website
|
||||||
location = Location
|
location = Location
|
||||||
|
pronouns = Pronouns
|
||||||
update_theme = Change theme
|
update_theme = Change theme
|
||||||
update_profile = Update profile
|
update_profile = Update profile
|
||||||
update_language = Change language
|
update_language = Change language
|
||||||
|
|
|
@ -236,6 +236,7 @@ func EditUser(ctx *context.APIContext) {
|
||||||
Website: optional.FromPtr(form.Website),
|
Website: optional.FromPtr(form.Website),
|
||||||
Location: optional.FromPtr(form.Location),
|
Location: optional.FromPtr(form.Location),
|
||||||
Description: optional.FromPtr(form.Description),
|
Description: optional.FromPtr(form.Description),
|
||||||
|
Pronouns: optional.FromPtr(form.Pronouns),
|
||||||
IsActive: optional.FromPtr(form.Active),
|
IsActive: optional.FromPtr(form.Active),
|
||||||
IsAdmin: optional.FromPtr(form.Admin),
|
IsAdmin: optional.FromPtr(form.Admin),
|
||||||
Visibility: optional.FromNonDefault(api.VisibilityModes[form.Visibility]),
|
Visibility: optional.FromNonDefault(api.VisibilityModes[form.Visibility]),
|
||||||
|
|
|
@ -48,6 +48,7 @@ func UpdateUserSettings(ctx *context.APIContext) {
|
||||||
opts := &user_service.UpdateOptions{
|
opts := &user_service.UpdateOptions{
|
||||||
FullName: optional.FromPtr(form.FullName),
|
FullName: optional.FromPtr(form.FullName),
|
||||||
Description: optional.FromPtr(form.Description),
|
Description: optional.FromPtr(form.Description),
|
||||||
|
Pronouns: optional.FromPtr(form.Pronouns),
|
||||||
Website: optional.FromPtr(form.Website),
|
Website: optional.FromPtr(form.Website),
|
||||||
Location: optional.FromPtr(form.Location),
|
Location: optional.FromPtr(form.Location),
|
||||||
Language: optional.FromPtr(form.Language),
|
Language: optional.FromPtr(form.Language),
|
||||||
|
|
|
@ -90,6 +90,7 @@ func ProfilePost(ctx *context.Context) {
|
||||||
FullName: optional.Some(form.FullName),
|
FullName: optional.Some(form.FullName),
|
||||||
KeepEmailPrivate: optional.Some(form.KeepEmailPrivate),
|
KeepEmailPrivate: optional.Some(form.KeepEmailPrivate),
|
||||||
Description: optional.Some(form.Description),
|
Description: optional.Some(form.Description),
|
||||||
|
Pronouns: optional.Some(form.Pronouns),
|
||||||
Website: optional.Some(form.Website),
|
Website: optional.Some(form.Website),
|
||||||
Location: optional.Some(form.Location),
|
Location: optional.Some(form.Location),
|
||||||
Visibility: optional.Some(form.Visibility),
|
Visibility: optional.Some(form.Visibility),
|
||||||
|
|
|
@ -218,6 +218,7 @@ type UpdateProfileForm struct {
|
||||||
KeepEmailPrivate bool
|
KeepEmailPrivate bool
|
||||||
Website string `binding:"ValidSiteUrl;MaxSize(255)"`
|
Website string `binding:"ValidSiteUrl;MaxSize(255)"`
|
||||||
Location string `binding:"MaxSize(50)"`
|
Location string `binding:"MaxSize(50)"`
|
||||||
|
Pronouns string `binding:"MaxSize(50)"`
|
||||||
Description string `binding:"MaxSize(255)"`
|
Description string `binding:"MaxSize(255)"`
|
||||||
Visibility structs.VisibleType
|
Visibility structs.VisibleType
|
||||||
KeepActivityPrivate bool
|
KeepActivityPrivate bool
|
||||||
|
|
|
@ -22,6 +22,7 @@ type UpdateOptions struct {
|
||||||
Website optional.Option[string]
|
Website optional.Option[string]
|
||||||
Location optional.Option[string]
|
Location optional.Option[string]
|
||||||
Description optional.Option[string]
|
Description optional.Option[string]
|
||||||
|
Pronouns optional.Option[string]
|
||||||
AllowGitHook optional.Option[bool]
|
AllowGitHook optional.Option[bool]
|
||||||
AllowImportLocal optional.Option[bool]
|
AllowImportLocal optional.Option[bool]
|
||||||
MaxRepoCreation optional.Option[int]
|
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")
|
cols = append(cols, "full_name")
|
||||||
}
|
}
|
||||||
|
if opts.Pronouns.Has() {
|
||||||
|
u.Pronouns = opts.Pronouns.Value()
|
||||||
|
|
||||||
|
cols = append(cols, "pronouns")
|
||||||
|
}
|
||||||
if opts.Website.Has() {
|
if opts.Website.Has() {
|
||||||
u.Website = opts.Website.Value()
|
u.Website = opts.Website.Value()
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="content gt-word-break profile-avatar-name">
|
<div class="content gt-word-break profile-avatar-name">
|
||||||
{{if .ContextUser.FullName}}<span class="header text center">{{.ContextUser.FullName}}</span>{{end}}
|
{{if .ContextUser.FullName}}<span class="header text center">{{.ContextUser.FullName}}</span>{{end}}
|
||||||
<span class="username text center">{{.ContextUser.Name}} {{if .IsAdmin}}
|
<span class="username text center">{{.ContextUser.Name}}{{if .ContextUser.Pronouns}} · {{.ContextUser.Pronouns}}{{end}} {{if .IsAdmin}}
|
||||||
<a class="muted" href="{{AppSubUrl}}/admin/users/{{.ContextUser.ID}}" data-tooltip-content="{{ctx.Locale.Tr "admin.users.details"}}">
|
<a class="muted" href="{{AppSubUrl}}/admin/users/{{.ContextUser.ID}}" data-tooltip-content="{{ctx.Locale.Tr "admin.users.details"}}">
|
||||||
{{svg "octicon-gear" 18}}
|
{{svg "octicon-gear" 18}}
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -37,6 +37,10 @@
|
||||||
<label for="location">{{ctx.Locale.Tr "settings.location"}}</label>
|
<label for="location">{{ctx.Locale.Tr "settings.location"}}</label>
|
||||||
<input id="location" name="location" placeholder="{{ctx.Locale.Tr "settings.location_placeholder"}}" value="{{.SignedUser.Location}}" maxlength="50">
|
<input id="location" name="location" placeholder="{{ctx.Locale.Tr "settings.location_placeholder"}}" value="{{.SignedUser.Location}}" maxlength="50">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label for="pronouns">{{.locale.Tr "settings.pronouns"}}</label>
|
||||||
|
<input id="pronouns" name="pronouns" value="{{.SignedUser.Pronouns}}" maxlength="50">
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
<!-- private block -->
|
<!-- private block -->
|
||||||
|
|
Loading…
Reference in a new issue