mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-13 05:11:20 +01:00
Rename Action.GetDisplayName to GetActDisplayName (#29540)
To avoid conflicting with User.GetDisplayName, because there is no data type in template. And it matches other methods like GetActFullName / GetActUserName (cherry picked from commit 3f081d4b54261c1b4ee4f1df40c610fdd9581ef2)
This commit is contained in:
parent
221a28436a
commit
be9189eddc
2 changed files with 5 additions and 5 deletions
|
@ -227,8 +227,8 @@ func (a *Action) ShortActUserName(ctx context.Context) string {
|
||||||
return base.EllipsisString(a.GetActUserName(ctx), 20)
|
return base.EllipsisString(a.GetActUserName(ctx), 20)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetDisplayName gets the action's display name based on DEFAULT_SHOW_FULL_NAME, or falls back to the username if it is blank.
|
// GetActDisplayName 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(ctx context.Context) string {
|
func (a *Action) GetActDisplayName(ctx context.Context) string {
|
||||||
if setting.UI.DefaultShowFullName {
|
if setting.UI.DefaultShowFullName {
|
||||||
trimmedFullName := strings.TrimSpace(a.GetActFullName(ctx))
|
trimmedFullName := strings.TrimSpace(a.GetActFullName(ctx))
|
||||||
if len(trimmedFullName) > 0 {
|
if len(trimmedFullName) > 0 {
|
||||||
|
@ -238,8 +238,8 @@ func (a *Action) GetDisplayName(ctx context.Context) string {
|
||||||
return a.ShortActUserName(ctx)
|
return a.ShortActUserName(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetDisplayNameTitle gets the action's display name used for the title (tooltip) based on DEFAULT_SHOW_FULL_NAME
|
// GetActDisplayNameTitle gets the action's display name used for the title (tooltip) based on DEFAULT_SHOW_FULL_NAME
|
||||||
func (a *Action) GetDisplayNameTitle(ctx context.Context) string {
|
func (a *Action) GetActDisplayNameTitle(ctx context.Context) string {
|
||||||
if setting.UI.DefaultShowFullName {
|
if setting.UI.DefaultShowFullName {
|
||||||
return a.ShortActUserName(ctx)
|
return a.ShortActUserName(ctx)
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<div class="flex-item-main gt-gap-3">
|
<div class="flex-item-main gt-gap-3">
|
||||||
<div>
|
<div>
|
||||||
{{if gt .ActUser.ID 0}}
|
{{if gt .ActUser.ID 0}}
|
||||||
<a href="{{AppSubUrl}}/{{(.GetActUserName ctx) | PathEscape}}" title="{{.GetDisplayNameTitle ctx}}">{{.GetDisplayName ctx}}</a>
|
<a href="{{AppSubUrl}}/{{(.GetActUserName ctx) | PathEscape}}" title="{{.GetActDisplayNameTitle ctx}}">{{.GetActDisplayName ctx}}</a>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{.ShortActUserName ctx}}
|
{{.ShortActUserName ctx}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
Loading…
Reference in a new issue