File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -120,10 +120,13 @@ func (a *Action) ShortActUserName() string {
120120 return base .EllipsisString (a .GetActUserName (), 20 )
121121}
122122
123- // GetDisplayName gets the action's display name based on DEFAULT_SHOW_FULL_NAME
123+ // GetDisplayName gets the action's display name based on DEFAULT_SHOW_FULL_NAME, or falls back to the username if it is blank.
124124func (a * Action ) GetDisplayName () string {
125125 if setting .UI .DefaultShowFullName {
126- return a .GetActFullName ()
126+ trimmedFullName := strings .TrimSpace (a .GetActFullName ())
127+ if len (trimmedFullName ) > 0 {
128+ return trimmedFullName
129+ }
127130 }
128131 return a .ShortActUserName ()
129132}
Original file line number Diff line number Diff line change @@ -739,9 +739,11 @@ func (u *User) DisplayName() string {
739739// GetDisplayName returns full name if it's not empty and DEFAULT_SHOW_FULL_NAME is set,
740740// returns username otherwise.
741741func (u * User ) GetDisplayName () string {
742- trimmed := strings .TrimSpace (u .FullName )
743- if len (trimmed ) > 0 && setting .UI .DefaultShowFullName {
744- return trimmed
742+ if setting .UI .DefaultShowFullName {
743+ trimmed := strings .TrimSpace (u .FullName )
744+ if len (trimmed ) > 0 {
745+ return trimmed
746+ }
745747 }
746748 return u .Name
747749}
You can’t perform that action at this time.
0 commit comments