aboutsummaryrefslogtreecommitdiffstats
path: root/models/action.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2019-05-08 10:41:35 +0200
committerLauris BH <lauris@nix.lv>2019-05-08 11:41:35 +0300
commit4508380cf7937aef0bf6f99fe3eefb6c530e38e3 (patch)
tree28d832a36e5aced26dce671591c58a1b1a00f22e /models/action.go
parenta84f10ad1afb8b3dcfa75093891d85f6f163715e (diff)
downloadgitea-4508380cf7937aef0bf6f99fe3eefb6c530e38e3.tar.gz
gitea-4508380cf7937aef0bf6f99fe3eefb6c530e38e3.zip
Show full name if DefaultShowFullName setting activated (#6710)
Adds a new key DEFAULT_SHOW_FULL_NAME (default false) to the [ui] section. If enabled the full name will be shown (unless it's empty, then the default username will be used)
Diffstat (limited to 'models/action.go')
-rw-r--r--models/action.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/models/action.go b/models/action.go
index b089870c74..01a6a91704 100644
--- a/models/action.go
+++ b/models/action.go
@@ -144,6 +144,22 @@ func (a *Action) ShortActUserName() string {
return base.EllipsisString(a.GetActUserName(), 20)
}
+// GetDisplayName gets the action's display name based on DEFAULT_SHOW_FULL_NAME
+func (a *Action) GetDisplayName() string {
+ if setting.UI.DefaultShowFullName {
+ return a.GetActFullName()
+ }
+ return a.ShortActUserName()
+}
+
+// GetDisplayNameTitle gets the action's display name used for the title (tooltip) based on DEFAULT_SHOW_FULL_NAME
+func (a *Action) GetDisplayNameTitle() string {
+ if setting.UI.DefaultShowFullName {
+ return a.ShortActUserName()
+ }
+ return a.GetActFullName()
+}
+
// GetActAvatar the action's user's avatar link
func (a *Action) GetActAvatar() string {
a.loadActUser()