aboutsummaryrefslogtreecommitdiffstats
path: root/models/user
diff options
context:
space:
mode:
authorBaekjun Kim <36013575+kimbj95@users.noreply.github.com>2022-07-05 06:30:05 -0500
committerGitHub <noreply@github.com>2022-07-05 12:30:05 +0100
commitc4368fc6bc385f678c0310911d17598abdc68b40 (patch)
tree6d8622ef8b7465575f966e00cdbe8916658455ce /models/user
parenta168609e847ad24c7f3d9d494bab2219fca71d60 (diff)
downloadgitea-c4368fc6bc385f678c0310911d17598abdc68b40.tar.gz
gitea-c4368fc6bc385f678c0310911d17598abdc68b40.zip
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.
Diffstat (limited to 'models/user')
-rw-r--r--models/user/user.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/models/user/user.go b/models/user/user.go
index 9460bd38fe..000af58513 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)
}