aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryp05327 <576951401@qq.com>2024-03-29 04:15:39 +0900
committerGitHub <noreply@github.com>2024-03-28 15:15:39 -0400
commit61036235966773a0af6b690b10b33ff8222df1d7 (patch)
tree63e0850fa5a24d36ccdf6c460d42a178ef4a77e5
parent40cdc84b368cce8328b4b49ea5ecf1c5fa040300 (diff)
downloadgitea-61036235966773a0af6b690b10b33ff8222df1d7.tar.gz
gitea-61036235966773a0af6b690b10b33ff8222df1d7.zip
Fix `DEFAULT_SHOW_FULL_NAME=false` has no effect in commit list and commit graph page (#30096)
Fix #20446 This PR will fix the username in: repo home page ![image](https://github.com/go-gitea/gitea/assets/18380374/347c0f70-ea42-432d-aae3-bf87a7e07ae1) repo commit list page ![image](https://github.com/go-gitea/gitea/assets/18380374/b3b1f5d5-c371-4222-ac2e-64b8994c7551) repo commit graph page ![image](https://github.com/go-gitea/gitea/assets/18380374/01b7117c-3aea-4d7d-8bd1-35e5ea942821) pr commit page ![image](https://github.com/go-gitea/gitea/assets/18380374/4d180c30-2150-4348-8eeb-0b4b2559ec19) Will not fix: wiki revisions page: ![image](https://github.com/go-gitea/gitea/assets/18380374/b49df6bf-d751-4374-b7ea-1ac85e2739e3) ps: the author name is `FullName` by default
-rw-r--r--templates/repo/commits_list.tmpl2
-rw-r--r--templates/repo/graph/commits.tmpl2
-rw-r--r--templates/repo/latest_commit.tmpl2
3 files changed, 3 insertions, 3 deletions
diff --git a/templates/repo/commits_list.tmpl b/templates/repo/commits_list.tmpl
index bae9924141..53052333fa 100644
--- a/templates/repo/commits_list.tmpl
+++ b/templates/repo/commits_list.tmpl
@@ -16,7 +16,7 @@
<td class="author tw-flex">
{{$userName := .Author.Name}}
{{if .User}}
- {{if .User.FullName}}
+ {{if and .User.FullName DefaultShowFullName}}
{{$userName = .User.FullName}}
{{end}}
{{ctx.AvatarUtils.Avatar .User 28 "tw-mr-2"}}<a class="muted author-wrapper" href="{{.User.HomeLink}}">{{$userName}}</a>
diff --git a/templates/repo/graph/commits.tmpl b/templates/repo/graph/commits.tmpl
index 96d09072da..f141dbeada 100644
--- a/templates/repo/graph/commits.tmpl
+++ b/templates/repo/graph/commits.tmpl
@@ -61,7 +61,7 @@
<span class="author tw-flex tw-items-center tw-mr-2">
{{$userName := $commit.Commit.Author.Name}}
{{if $commit.User}}
- {{if $commit.User.FullName}}
+ {{if and $commit.User.FullName DefaultShowFullName}}
{{$userName = $commit.User.FullName}}
{{end}}
<span class="tw-mr-1">{{ctx.AvatarUtils.Avatar $commit.User}}</span>
diff --git a/templates/repo/latest_commit.tmpl b/templates/repo/latest_commit.tmpl
index f945e9dfa1..8bacb427bf 100644
--- a/templates/repo/latest_commit.tmpl
+++ b/templates/repo/latest_commit.tmpl
@@ -3,7 +3,7 @@
{{else}}
{{if .LatestCommitUser}}
{{ctx.AvatarUtils.Avatar .LatestCommitUser 24 "tw-mr-1"}}
- {{if .LatestCommitUser.FullName}}
+ {{if and .LatestCommitUser.FullName DefaultShowFullName}}
<a class="muted author-wrapper" title="{{.LatestCommitUser.FullName}}" href="{{.LatestCommitUser.HomeLink}}"><strong>{{.LatestCommitUser.FullName}}</strong></a>
{{else}}
<a class="muted author-wrapper" title="{{if .LatestCommit.Author}}{{.LatestCommit.Author.Name}}{{else}}{{.LatestCommitUser.Name}}{{end}}" href="{{.LatestCommitUser.HomeLink}}"><strong>{{if .LatestCommit.Author}}{{.LatestCommit.Author.Name}}{{else}}{{.LatestCommitUser.Name}}{{end}}</strong></a>