mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-29 10:57:44 +09:00 
			
		
		
		
	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)
This commit is contained in:
		| @@ -661,6 +661,16 @@ func (u *User) DisplayName() string { | ||||
| 	return u.Name | ||||
| } | ||||
|  | ||||
| // 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 | ||||
| 	} | ||||
| 	return u.Name | ||||
| } | ||||
|  | ||||
| func gitSafeName(name string) string { | ||||
| 	return strings.TrimSpace(strings.NewReplacer("\n", "", "<", "", ">", "").Replace(name)) | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user