Skip to content
32 changes: 27 additions & 5 deletions templates/repo/commit_page.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,24 @@
</div>
<div class="ui attached segment gt-df gt-ac gt-sb gt-py-2 commit-header-row gt-fw {{$class}}">
<div class="gt-df gt-ac author">
{{- /* .Author: User model (might be nil) */ -}}
{{- /* .Commit: modules/git/Commit */ -}}
{{- /* .Commit.Author: modules/git/Signature{Name, Email, When}, commit information stored in commit */ -}}
{{- /* .Commit.Committer: modules/git/Signature{Name, Email, When}, commit information stored in commit */ -}}
{{- /* .Verification: modules/git/CommitVerification */ -}}
{{- /* .Verification.SigningUser: User model */ -}}
{{- /* .Verification.CommittingUser: User model */ -}}
{{if .Author}}
{{avatar $.Context .Author 28 "gt-mr-3"}}
{{if .Author.FullName}}
<a href="{{.Author.HomeLink}}"><strong>{{.Author.FullName}}</strong></a>
<a href="{{.Author.HomeLink}}">
{{if eq .Commit.Author.Name .Author.Name}}
{{- /* show as: "UserName (FullName)" */ -}}
<strong>{{.Commit.Author.Name}}{{if and DefaultShowFullName .Author.FullName}} ({{.Author.FullName}}){{end}}</strong>
{{else}}
<a href="{{.Author.HomeLink}}"><strong>{{.Commit.Author.Name}}</strong></a>
{{/* If the committer name and username don't match, use an alternative "CommitterName (UserName / FullName)" format */}}
<strong>{{.Commit.Author.Name}} ({{.Author.Name}}{{if and DefaultShowFullName .Author.FullName}} / {{.Author.FullName}}{{end}})</strong>
{{end}}
</a>
{{else}}
{{avatarByEmail $.Context .Commit.Author.Email .Commit.Author.Email 28 "gt-mr-3"}}
<strong>{{.Commit.Author.Name}}</strong>
Expand All @@ -157,7 +168,13 @@
<span class="text grey gt-mx-3">{{.locale.Tr "repo.diff.committed_by"}}</span>
{{if ne .Verification.CommittingUser.ID 0}}
{{avatar $.Context .Verification.CommittingUser 28 "gt-mx-3"}}
<a href="{{.Verification.CommittingUser.HomeLink}}"><strong>{{.Commit.Committer.Name}}</strong></a>
{{if eq .Commit.Committer.Name .Verification.CommittingUser.Name}}
{{- /* show as: "UserName (FullName)" */ -}}
<a href="{{.Verification.CommittingUser.HomeLink}}"><strong>{{.Commit.Committer.Name}}{{if and DefaultShowFullName .Verification.CommittingUser.FullName}} ({{.Verification.CommittingUser.FullName}}){{end}}</strong></a>
{{else}}
{{- /* show as: "CommitterName (UserName / FullName)" */ -}}
<a href="{{.Verification.CommittingUser.HomeLink}}"><strong>{{.Commit.Committer.Name}} ({{.Verification.CommittingUser.Name}}{{if and DefaultShowFullName .Verification.CommittingUser.FullName}} / {{.Verification.CommittingUser.FullName}}{{end}})</strong></a>
{{end}}
{{else}}
{{avatarByEmail $.Context .Commit.Committer.Email .Commit.Committer.Name 28 "gt-mr-3"}}
<strong>{{.Commit.Committer.Name}}</strong>
Expand Down Expand Up @@ -197,7 +214,12 @@
<span class="ui text gt-mr-3">{{.locale.Tr "repo.commits.signed_by_untrusted_user_unmatched"}}:</span>
{{end}}
{{avatar $.Context .Verification.SigningUser 28 "gt-mr-3"}}
<a href="{{.Verification.SigningUser.HomeLink}}"><strong>{{.Verification.SigningUser.GetDisplayName}}</strong></a>
{{if and DefaultShowFullName .Verification.SigningUser.FullName}}
{{/* Use the same scheme as the one used in commits. */}}
<a href="{{.Verification.SigningUser.HomeLink}}"><strong>{{.Verification.SigningUser.Name}} ({{.Verification.SigningUser.FullName}})</strong></a>
{{else}}
<a href="{{.Verification.SigningUser.HomeLink}}"><strong>{{.Verification.SigningUser.Name}}</strong></a>
{{end}}
{{else}}
<span title="{{.locale.Tr "gpg.default_key"}}">{{svg "gitea-lock-cog" 16 "gt-mr-3"}}</span>
<span class="ui text gt-mr-3">{{.locale.Tr "repo.commits.signed_by"}}:</span>
Expand Down