aboutsummaryrefslogtreecommitdiffstats
path: root/models/user.go
diff options
context:
space:
mode:
authorJames Lakin <jamesorlakin@users.noreply.github.com>2020-02-26 22:08:24 +0000
committerGitHub <noreply@github.com>2020-02-26 22:08:24 +0000
commit7ffc2427daad725e448abfa1828b10acdba1a02c (patch)
treed13ae5703ff4cf04133ad3ff1fabb0f03b058d47 /models/user.go
parentef798d4b84ae17b3b45221e828112a9bd992757e (diff)
downloadgitea-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/user.go')
-rw-r--r--models/user.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/models/user.go b/models/user.go
index 8be15ba6df..30ede2373e 100644
--- a/models/user.go
+++ b/models/user.go
@@ -739,9 +739,11 @@ func (u *User) DisplayName() string {
// GetDisplayName returns full name if it's not empty and DEFAULT_SHOW_FULL_NAME is set,
// returns username otherwise.
func (u *User) GetDisplayName() string {
- trimmed := strings.TrimSpace(u.FullName)
- if len(trimmed) > 0 && setting.UI.DefaultShowFullName {
- return trimmed
+ if setting.UI.DefaultShowFullName {
+ trimmed := strings.TrimSpace(u.FullName)
+ if len(trimmed) > 0 {
+ return trimmed
+ }
}
return u.Name
}