pull/36094/head
silverwind 2025-12-11 02:28:22 +07:00
parent 8e1e53a4fb
commit 0cde670b4a
No known key found for this signature in database
GPG Key ID: 2E62B41C93869443
4 changed files with 78 additions and 39 deletions

@ -0,0 +1,58 @@
{{/* Template Attributes:
* User: The user associated with the commit
* Author: The author associated with the commit
* Commit: The author associated with the commit
* AvatarSize: Avatar size in pixels
* AuthorBold: Whether to render the autor as bold text
* IsSigned: Whether the user is currently signed in
* Hack: Hack to avoid error related to .Author.FullName and .Author.HomeLink
*/}}
<div class="flex-text-inline{{if .AuthorBold}} tw-font-semibold{{end}}">
{{if .User}}
{{ctx.AvatarUtils.Avatar .User .AvatarSize}}
{{$username := ""}}
{{if and .User.FullName DefaultShowFullName}}
{{$username = .User.FullName}}
{{else if .User.Name}}
{{$username = .User.Name}}
{{end}}
<a class="muted author-wrapper" href="{{.User.HomeLink}}" data-tooltip-content="{{$username}}">
{{$username}}
</a>
{{else if .Author}}
b
{{$username := ""}}
{{if and .Author .Author.FullName DefaultShowFullName}}
{{$username = .Author.FullName}}
{{else if .Author.Name}}
{{$username = .Author.Name}}
{{else if and .Commit .Commit.Author .Commit.Author.Name}}
{{$username = .Commit.Author.Name}}
{{end}}
{{ctx.AvatarUtils.AvatarByEmail .Author.Email $username .AvatarSize}}
<span{{if .IsSigned}} title="{{.Author.Email}}"{{end}}>
{{if and .Hack .Author.HomeLink}}
<a class="muted author-wrapper" href="{{.Author.HomeLink}}">
{{$username}}
</a>
{{else}}
{{$username}}
{{end}}
</span>
{{else}}
{{$username := ""}}
{{if and .Commit .Commit.Author .Commit.Author.Name}}
{{$username = .Commit.Author.Name}}
{{else}}
{{$username = .Author.Name}}
{{end}}
{{ctx.AvatarUtils.AvatarByEmail .Commit.Author.Email $username .AvatarSize}}
<span{{if .IsSigned}} title="{{.Commit.Author.Email}}"{{end}}>
{{if and .Commit .Commit.Author .Commit.Author.Name}}
{{.Commit.Author.Name}}
{{else}}
{{.Author.Name}}
{{end}}
</span>
{{end}}
</div>

@ -128,21 +128,13 @@
</div>
<div class="ui bottom attached segment flex-text-block tw-flex-wrap">
{{if .Author}}
<div class="flex-text-inline">
{{ctx.AvatarUtils.Avatar .Author 20}}
{{if .Author.FullName}}
<a href="{{.Author.HomeLink}}"><strong>{{.Author.FullName}}</strong></a>
{{else}}
<a href="{{.Author.HomeLink}}"><strong>{{.Commit.Author.Name}}</strong></a>
{{end}}
</div>
{{else}}
<div class="flex-text-inline" data-tooltip-content={{.Commit.Author.Email}}>
{{ctx.AvatarUtils.AvatarByEmail .Commit.Author.Email .Commit.Author.Email 20}}
<strong>{{.Commit.Author.Name}}</strong>
</div>
{{end}}
{{template "repo/commit_author" (dict
"Author" .Author
"Commit" .Commit
"AvatarSize" 20
"AuthorBold" true
"IsSigned" $.IsSigned
)}}
<span class="text grey">{{DateUtils.TimeSince .Commit.Author.When}}</span>

@ -15,16 +15,12 @@
<tr>
<td class="author">
<div class="tw-flex">
{{$userName := .Author.Name}}
{{if .User}}
{{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>
{{else}}
{{ctx.AvatarUtils.AvatarByEmail .Author.Email .Author.Email 28 "tw-mr-2"}}
<span class="author-wrapper" data-tooltip-content={{.Author.Email}}>{{$userName}}</span>
{{end}}
{{template "repo/commit_author" (dict
"User" .User
"Author" .Author
"AvatarSize" 28
"IsSigned" $.IsSigned
)}}
</div>
</td>
<td class="sha">

@ -2,20 +2,13 @@
{{if not .LatestCommit}}
{{else}}
{{if .LatestCommitUser}}
{{ctx.AvatarUtils.Avatar .LatestCommitUser 24}}
{{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>
{{end}}
{{else}}
{{if .LatestCommit.Author}}
{{ctx.AvatarUtils.AvatarByEmail .LatestCommit.Author.Email .LatestCommit.Author.Name 24}}
<span class="author-wrapper" data-tooltip-content={{.LatestCommit.Author.Email}}><strong>{{.LatestCommit.Author.Name}}</strong></span>
{{end}}
{{end}}
{{template "repo/commit_author" (dict
"User" .LatestCommitUser
"Author" .LatestCommit.Author
"AvatarSize" 24
"AuthorBold" true
"IsSigned" $.IsSigned
)}}
{{template "repo/commit_sign_badge" dict "Commit" .LatestCommit "CommitBaseLink" (print .RepoLink "/commit") "CommitSignVerification" .LatestCommitVerification}}
{{template "repo/commit_statuses" dict "Status" .LatestCommitStatus "Statuses" .LatestCommitStatuses}}