Skip to content

Commit

Permalink
Display full name (#20171) (#20246)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
zeripath and kimbj95 authored Jul 5, 2022
1 parent c88a59b commit 76ba23a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions models/user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 76ba23a

Please sign in to comment.