Display full name (#20171)

The setting `DEFAULT_SHOW_FULL_NAME` promises to use the user's full name everywhere it can be used.

Unfortunately the function `*user_model.User.ShortName()` currently uses the `.Name` instead - but this should also use the `.FullName()`.

Therefore we should make `*user_model.User.ShortName()` base its pre-shortened name on the `.FullName()` function.
This commit is contained in:
Baekjun Kim 2022-07-05 06:30:05 -05:00 committed by GitHub
parent a168609e84
commit c4368fc6bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -485,6 +485,9 @@ func (u *User) GitName() string {
// ShortName ellipses username to length // ShortName ellipses username to length
func (u *User) ShortName(length int) string { func (u *User) ShortName(length int) string {
if setting.UI.DefaultShowFullName && len(u.FullName) > 0 {
return base.EllipsisString(u.FullName, length)
}
return base.EllipsisString(u.Name, length) return base.EllipsisString(u.Name, length)
} }