Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions models/user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,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)"`
Expand Down
1 change: 1 addition & 0 deletions modules/structs/admin_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,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"`
Expand Down
1 change: 1 addition & 0 deletions modules/structs/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,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"`
Expand Down
2 changes: 2 additions & 0 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,7 @@ password_full_name_disabled = You are not allowed to change your full name. Plea
full_name = Full Name
website = Website
location = Location
pronouns = Pronouns
update_theme = Update Theme
update_profile = Update Profile
update_language = Update Language
Expand Down Expand Up @@ -2840,6 +2841,7 @@ settings.full_name = Full Name
settings.email = Contact Email Address
settings.website = Website
settings.location = Location
settings.pronouns = Pronouns
settings.permission = Permissions
settings.repoadminchangeteam = Repository admin can add and remove access for teams
settings.visibility = Visibility
Expand Down
1 change: 1 addition & 0 deletions routers/api/v1/admin/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@
Website: optional.FromPtr(form.Website),
Location: optional.FromPtr(form.Location),
Description: optional.FromPtr(form.Description),
Pronouns: optional.FromPtr(form.Pronouns),

Check failure on line 241 in routers/api/v1/admin/user.go

View workflow job for this annotation

GitHub Actions / lint-backend

File is not properly formatted (gofmt)

Check failure on line 241 in routers/api/v1/admin/user.go

View workflow job for this annotation

GitHub Actions / lint-go-gogit

File is not properly formatted (gofmt)

Check failure on line 241 in routers/api/v1/admin/user.go

View workflow job for this annotation

GitHub Actions / lint-go-windows

File is not properly formatted (gofmt)
IsActive: optional.FromPtr(form.Active),
IsAdmin: user_service.UpdateOptionFieldFromPtr(form.Admin),
Visibility: optional.FromMapLookup(api.VisibilityModes, form.Visibility),
Expand Down
1 change: 1 addition & 0 deletions routers/api/v1/user/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
1 change: 1 addition & 0 deletions routers/web/admin/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,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: user_service.UpdateOptionFieldFromValue(form.Admin),
AllowGitHook: optional.Some(form.AllowGitHook),
Expand Down
1 change: 1 addition & 0 deletions routers/web/user/setting/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ func ProfilePost(ctx *context.Context) {
opts := &user_service.UpdateOptions{
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),
Expand Down
1 change: 1 addition & 0 deletions services/forms/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type AdminEditUserForm struct {
Password string `binding:"MaxSize(255)"`
Website string `binding:"ValidUrl;MaxSize(255)"`
Location string `binding:"MaxSize(50)"`
Pronouns string `binding:"MaxSize(50)"`
Language string `binding:"MaxSize(5)"`
MaxRepoCreation int
Active bool
Expand Down
1 change: 1 addition & 0 deletions services/forms/user_form.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,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
Expand Down
6 changes: 6 additions & 0 deletions services/user/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,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]
Expand Down Expand Up @@ -72,6 +73,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()

Expand Down
4 changes: 4 additions & 0 deletions templates/admin/user/edit.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@
<label for="full_name">{{ctx.Locale.Tr "settings.full_name"}}</label>
<input id="full_name" name="full_name" value="{{.User.FullName}}" maxlength="100">
</div>
<div class="field">
<label for="pronouns">{{ctx.Locale.Tr "settings.pronouns"}}</label>
<input id="pronouns" name="pronouns" value="{{.User.Pronouns}}" maxlength="50">
</div>
<div class="required field {{if .Err_Email}}error{{end}}">
<label for="email">{{ctx.Locale.Tr "email"}}</label>
<input id="email" name="email" type="email" value="{{.User.Email}}" required>
Expand Down
2 changes: 1 addition & 1 deletion templates/shared/user/profile_big_avatar.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</div>
<div class="content tw-break-anywhere profile-avatar-name">
{{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"}}">
{{svg "octicon-gear" 18}}
</a>
Expand Down
4 changes: 4 additions & 0 deletions templates/user/settings/profile.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
<p class="help text blue">{{ctx.Locale.Tr "settings.password_full_name_disabled"}}</p>
{{end}}
</div>
<div class="field">
<label for="pronouns">{{ctx.Locale.Tr "settings.pronouns"}}</label>
<input id="pronouns" name="pronouns" value="{{.SignedUser.Pronouns}}" maxlength="50">
</div>
<div class="field {{if .Err_Email}}error{{end}}">
<label>{{ctx.Locale.Tr "email"}}</label>
<p id="signed-user-email">{{.SignedUser.Email}}</p>
Expand Down
Loading