diff options
author | James Lakin <jamesorlakin@users.noreply.github.com> | 2020-02-26 22:08:24 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-26 22:08:24 +0000 |
commit | 7ffc2427daad725e448abfa1828b10acdba1a02c (patch) | |
tree | d13ae5703ff4cf04133ad3ff1fabb0f03b058d47 /models/action.go | |
parent | ef798d4b84ae17b3b45221e828112a9bd992757e (diff) | |
download | gitea-7ffc2427daad725e448abfa1828b10acdba1a02c.tar.gz gitea-7ffc2427daad725e448abfa1828b10acdba1a02c.zip |
Show the username as a fallback on feeds if full name is blank (#10438)
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'models/action.go')
-rw-r--r-- | models/action.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/models/action.go b/models/action.go index b8694aad73..267a19bc62 100644 --- a/models/action.go +++ b/models/action.go @@ -120,10 +120,13 @@ func (a *Action) ShortActUserName() string { return base.EllipsisString(a.GetActUserName(), 20) } -// GetDisplayName gets the action's display name based on DEFAULT_SHOW_FULL_NAME +// GetDisplayName gets the action's display name based on DEFAULT_SHOW_FULL_NAME, or falls back to the username if it is blank. func (a *Action) GetDisplayName() string { if setting.UI.DefaultShowFullName { - return a.GetActFullName() + trimmedFullName := strings.TrimSpace(a.GetActFullName()) + if len(trimmedFullName) > 0 { + return trimmedFullName + } } return a.ShortActUserName() } |