diff options
author | zeripath <art27@cantab.net> | 2022-07-05 16:58:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-05 16:58:10 +0100 |
commit | 76ba23a14fa39036eb4d8c96b3326ea4842ef9e7 (patch) | |
tree | 0ffdf3f4ffaa85e72bcbae0ad0d5c18c3401936e | |
parent | c88a59bb23b324cc32b33e4275d0dc3eeb6776de (diff) | |
download | gitea-76ba23a14fa39036eb4d8c96b3326ea4842ef9e7.tar.gz gitea-76ba23a14fa39036eb4d8c96b3326ea4842ef9e7.zip |
Display full name (#20171) (#20246)
Backport #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.
Co-authored-by: Baekjun Kim <36013575+kimbj95@users.noreply.github.com>
-rw-r--r-- | models/user/user.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/models/user/user.go b/models/user/user.go index f7d457b91b..a2c759cf80 100644 --- a/models/user/user.go +++ b/models/user/user.go @@ -485,6 +485,9 @@ func (u *User) GitName() string { // ShortName ellipses username to length 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) } |