1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-03 09:07:19 +00:00

De-emphasize signed commits (#31160)

The new code structure is easier to make more improvements or
refactor, for example: change the colors to de-emphasize more, or design
some new layouts.

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Blender Defender
2024-12-27 21:18:30 +01:00
committed by GitHub
parent ea198f9ea8
commit 079a1ffe8f
17 changed files with 304 additions and 555 deletions

View File

@ -0,0 +1,13 @@
{{template "devtest/devtest-header"}}
<div class="page-content devtest ui container">
<div>
<h1>Commit Sign Badges</h1>
{{range $commit := .MockCommits}}
<div class="flex-text-block tw-my-2">
{{template "repo/commit_sign_badge" dict "Commit" $commit "CommitBaseLink" "/devtest/commit" "CommitSignVerification" $commit.Verification}}
{{template "repo/commit_sign_badge" dict "CommitSignVerification" $commit.Verification}}
</div>
{{end}}
</div>
</div>
{{template "devtest/devtest-footer"}}

View File

@ -1,23 +1,9 @@
{{template "base/head" .}}
{{$commitLinkBase := print $.RepoLink (Iif $.PageIsWiki "/wiki" "") "/commit"}}
<div role="main" aria-label="{{.Title}}" class="page-content repository diff">
{{template "repo/header" .}}
<div class="ui container fluid padded">
{{$class := ""}}
{{if .Commit.Signature}}
{{$class = (print $class " isSigned")}}
{{if .Verification.Verified}}
{{if eq .Verification.TrustStatus "trusted"}}
{{$class = (print $class " isVerified")}}
{{else if eq .Verification.TrustStatus "untrusted"}}
{{$class = (print $class " isVerifiedUntrusted")}}
{{else}}
{{$class = (print $class " isVerifiedUnmatched")}}
{{end}}
{{else if .Verification.Warning}}
{{$class = (print $class " isWarning")}}
{{end}}
{{end}}
<div class="ui top attached header clearing segment tw-relative commit-header {{$class}}">
<div class="ui top attached header clearing segment tw-relative commit-header">
<div class="tw-flex tw-mb-4 tw-gap-1">
<h3 class="tw-mb-0 tw-flex-1"><span class="commit-summary" title="{{.Commit.Summary}}">{{ctx.RenderUtils.RenderCommitMessage .Commit.Message ($.Repository.ComposeMetas ctx)}}</span>{{template "repo/commit_statuses" dict "Status" .CommitStatus "Statuses" .CommitStatuses}}</h3>
{{if not $.PageIsWiki}}
@ -142,125 +128,59 @@
{{end}}
{{template "repo/commit_load_branches_and_tags" .}}
</div>
<div class="ui{{if not .Commit.Signature}} bottom{{end}} attached segment tw-flex tw-items-center tw-justify-between tw-py-1 commit-header-row tw-flex-wrap {{$class}}">
<div class="tw-flex tw-items-center author">
{{if .Author}}
{{ctx.AvatarUtils.Avatar .Author 28 "tw-mr-2"}}
{{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 class="ui bottom attached segment flex-text-block tw-flex-wrap">
<div class="flex-text-inline">
{{if .Author}}
{{ctx.AvatarUtils.Avatar .Author 20}}
{{if .Author.FullName}}
<a href="{{.Author.HomeLink}}"><strong>{{.Author.FullName}}</strong></a>
{{else}}
{{ctx.AvatarUtils.AvatarByEmail .Commit.Author.Email .Commit.Author.Email 28 "tw-mr-2"}}
<strong>{{.Commit.Author.Name}}</strong>
<a href="{{.Author.HomeLink}}"><strong>{{.Commit.Author.Name}}</strong></a>
{{end}}
<span class="text grey tw-ml-2" id="authored-time">{{DateUtils.TimeSince .Commit.Author.When}}</span>
{{if or (ne .Commit.Committer.Name .Commit.Author.Name) (ne .Commit.Committer.Email .Commit.Author.Email)}}
<span class="text grey tw-mx-2">{{ctx.Locale.Tr "repo.diff.committed_by"}}</span>
{{if ne .Verification.CommittingUser.ID 0}}
{{ctx.AvatarUtils.Avatar .Verification.CommittingUser 28 "tw-mx-2"}}
<a href="{{.Verification.CommittingUser.HomeLink}}"><strong>{{.Commit.Committer.Name}}</strong></a>
{{else}}
{{ctx.AvatarUtils.AvatarByEmail .Commit.Committer.Email .Commit.Committer.Name 28 "tw-mr-2"}}
<strong>{{.Commit.Committer.Name}}</strong>
{{else}}
{{ctx.AvatarUtils.AvatarByEmail .Commit.Author.Email .Commit.Author.Email 20}}
<strong>{{.Commit.Author.Name}}</strong>
{{end}}
</div>
<span class="text grey">{{DateUtils.TimeSince .Commit.Author.When}}</span>
<div class="flex-text-inline">
{{if or (ne .Commit.Committer.Name .Commit.Author.Name) (ne .Commit.Committer.Email .Commit.Author.Email)}}
<span class="text grey">{{ctx.Locale.Tr "repo.diff.committed_by"}}</span>
{{if ne .Verification.CommittingUser.ID 0}}
{{ctx.AvatarUtils.Avatar .Verification.CommittingUser 20}}
<a href="{{.Verification.CommittingUser.HomeLink}}"><strong>{{.Commit.Committer.Name}}</strong></a>
{{else}}
{{ctx.AvatarUtils.AvatarByEmail .Commit.Committer.Email .Commit.Committer.Name 20}}
<strong>{{.Commit.Committer.Name}}</strong>
{{end}}
{{end}}
</div>
{{if .Verification}}
{{template "repo/commit_sign_badge" dict "CommitSignVerification" .Verification}}
{{end}}
<div class="tw-flex-1"></div>
<div class="flex-text-inline tw-gap-5">
{{if .Parents}}
<div class="flex-text-inline">
<span>{{ctx.Locale.Tr "repo.diff.parent"}}</span>
{{range .Parents}}
<a class="ui label commit-id-short" href="{{$commitLinkBase}}/{{PathEscape .}}">{{ShortSha .}}</a>
{{end}}
{{end}}
</div>
<div class="tw-flex tw-items-center">
{{if .Parents}}
<div>
<span>{{ctx.Locale.Tr "repo.diff.parent"}}</span>
{{range .Parents}}
{{if $.PageIsWiki}}
<a class="ui primary sha label" href="{{$.RepoLink}}/wiki/commit/{{PathEscape .}}">{{ShortSha .}}</a>
{{else}}
<a class="ui primary sha label" href="{{$.RepoLink}}/commit/{{PathEscape .}}">{{ShortSha .}}</a>
{{end}}
{{end}}
</div>
{{end}}
<div class="item">
<span>{{ctx.Locale.Tr "repo.diff.commit"}}</span>
<span class="ui primary sha label">{{ShortSha .CommitID}}</span>
</div>
</div>
</div>
{{if .Commit.Signature}}
<div class="ui bottom attached message tw-text-left tw-flex tw-items-center tw-justify-between commit-header-row tw-flex-wrap tw-mb-0 {{$class}}">
<div class="tw-flex tw-items-center">
{{if .Verification.Verified}}
{{if ne .Verification.SigningUser.ID 0}}
{{svg "gitea-lock" 16 "tw-mr-2"}}
{{if eq .Verification.TrustStatus "trusted"}}
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.signed_by"}}:</span>
{{else if eq .Verification.TrustStatus "untrusted"}}
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.signed_by_untrusted_user"}}:</span>
{{else}}
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.signed_by_untrusted_user_unmatched"}}:</span>
{{end}}
{{ctx.AvatarUtils.Avatar .Verification.SigningUser 28 "tw-mr-2"}}
<a href="{{.Verification.SigningUser.HomeLink}}"><strong>{{.Verification.SigningUser.GetDisplayName}}</strong></a>
{{else}}
<span title="{{ctx.Locale.Tr "gpg.default_key"}}">{{svg "gitea-lock-cog" 16 "tw-mr-2"}}</span>
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.signed_by"}}:</span>
{{ctx.AvatarUtils.AvatarByEmail .Verification.SigningEmail "" 28 "tw-mr-2"}}
<strong>{{.Verification.SigningUser.GetDisplayName}}</strong>
{{end}}
{{else}}
{{svg "gitea-unlock" 16 "tw-mr-2"}}
<span class="ui text">{{ctx.Locale.Tr .Verification.Reason}}</span>
{{end}}
</div>
<div class="tw-flex tw-items-center">
{{if .Verification.Verified}}
{{if ne .Verification.SigningUser.ID 0}}
{{svg "octicon-verified" 16 "tw-mr-2"}}
{{if .Verification.SigningSSHKey}}
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
{{.Verification.SigningSSHKey.Fingerprint}}
{{else}}
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span>
{{.Verification.SigningKey.PaddedKeyID}}
{{end}}
{{else}}
{{svg "octicon-unverified" 16 "tw-mr-2"}}
{{if .Verification.SigningSSHKey}}
<span class="ui text tw-mr-2" data-tooltip-content="{{ctx.Locale.Tr "gpg.default_key"}}">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
{{.Verification.SigningSSHKey.Fingerprint}}
{{else}}
<span class="ui text tw-mr-2" data-tooltip-content="{{ctx.Locale.Tr "gpg.default_key"}}">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span>
{{.Verification.SigningKey.PaddedKeyID}}
{{end}}
{{end}}
{{else if .Verification.Warning}}
{{svg "octicon-unverified" 16 "tw-mr-2"}}
{{if .Verification.SigningSSHKey}}
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
{{.Verification.SigningSSHKey.Fingerprint}}
{{else}}
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span>
{{.Verification.SigningKey.PaddedKeyID}}
{{end}}
{{else}}
{{if .Verification.SigningKey}}
{{if ne .Verification.SigningKey.KeyID ""}}
{{svg "octicon-verified" 16 "tw-mr-2"}}
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span>
{{.Verification.SigningKey.PaddedKeyID}}
{{end}}
{{end}}
{{if .Verification.SigningSSHKey}}
{{if ne .Verification.SigningSSHKey.Fingerprint ""}}
{{svg "octicon-verified" 16 "tw-mr-2"}}
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
{{.Verification.SigningSSHKey.Fingerprint}}
{{end}}
{{end}}
{{end}}
{{end}}
<div class="flex-text-inline">
<span>{{ctx.Locale.Tr "repo.diff.commit"}}</span>
<a class="ui label commit-id-short" href="{{$commitLinkBase}}/{{PathEscape .CommitID}}">{{ShortSha .CommitID}}</a>
</div>
</div>
{{end}}
</div>
{{if .NoteRendered}}
<div class="ui top attached header segment git-notes">
{{svg "octicon-note" 16 "tw-mr-2"}}
@ -276,12 +196,13 @@
{{else}}
<strong>{{.NoteCommit.Author.Name}}</strong>
{{end}}
<span class="text grey" id="note-authored-time">{{DateUtils.TimeSince .NoteCommit.Author.When}}</span>
<span class="text grey">{{DateUtils.TimeSince .NoteCommit.Author.When}}</span>
</div>
<div class="ui bottom attached info segment git-notes">
<pre class="commit-body">{{.NoteRendered | SanitizeHTML}}</pre>
</div>
{{end}}
{{template "repo/diff/box" .}}
</div>
</div>

View File

@ -0,0 +1,78 @@
{{/* Template attributes:
* Commit
* CommitBaseLink
* CommitSignVerification
If you'd like to modify this template, you could test it on the devtest page.
ATTENTION: this template could be re-rendered many times (on the graph and commit list page),
so this template should be kept as small as possbile, DO NOT put large components like modal/dialog into it.
*/}}
{{- $commit := $.Commit -}}
{{- $commitBaseLink := $.CommitBaseLink -}}
{{- $verification := $.CommitSignVerification -}}
{{- $extraClass := "" -}}
{{- $verified := false -}}
{{- $signingUser := NIL -}}
{{- $signingEmail := "" -}}
{{- $msgReasonPrefix := "" -}}
{{- $msgReason := "" -}}
{{- $msgSigningKey := "" -}}
{{- if $verification -}}
{{- $signingUser = $verification.SigningUser -}}
{{- $signingEmail = $verification.SigningEmail -}}
{{- $extraClass = print $extraClass " commit-is-signed" -}}
{{- if $verification.Verified -}}
{{- /* reason is "{name} / {key-id}" */ -}}
{{- $msgReason = $verification.Reason -}}
{{- $verified = true -}}
{{- if eq $verification.TrustStatus "trusted" -}}
{{- $extraClass = print $extraClass " sign-trusted" -}}
{{- else if eq $verification.TrustStatus "untrusted" -}}
{{- $extraClass = print $extraClass " sign-untrusted" -}}
{{- $msgReasonPrefix = ctx.Locale.Tr "repo.commits.signed_by_untrusted_user" -}}
{{- else -}}
{{- $extraClass = print $extraClass " sign-unmatched" -}}
{{- $msgReasonPrefix = ctx.Locale.Tr "repo.commits.signed_by_untrusted_user_unmatched" -}}
{{- end -}}
{{- else -}}
{{- if $verification.Warning -}}
{{- $extraClass = print $extraClass " sign-warning" -}}
{{- end -}}
{{- $msgReason = ctx.Locale.Tr $verification.Reason -}}{{- /* dirty part: it is the translation key ..... */ -}}
{{- end -}}
{{- if $msgReasonPrefix -}}
{{- $msgReason = print $msgReasonPrefix ": " $msgReason -}}
{{- end -}}
{{- if $verification.SigningSSHKey -}}
{{- $msgSigningKey = print (ctx.Locale.Tr "repo.commits.ssh_key_fingerprint") ": " $verification.SigningSSHKey.Fingerprint -}}
{{- else if $verification.SigningKey -}}
{{- $msgSigningKey = print (ctx.Locale.Tr "repo.commits.gpg_key_id") ": " $verification.SigningKey.PaddedKeyID -}}
{{- end -}}
{{- end -}}
{{- if $commit -}}
<a {{if $commitBaseLink}}href="{{$commitBaseLink}}/{{$commit.ID}}"{{end}} class="ui label commit-id-short {{$extraClass}}" rel="nofollow">
{{- ShortSha $commit.ID.String -}}
{{- end -}}
<span class="ui label commit-sign-badge {{$extraClass}}">
{{- if $verified -}}
{{- if and $signingUser $signingUser.ID -}}
<span data-tooltip-content="{{$msgReason}}">{{svg "gitea-lock"}}</span>
<span data-tooltip-content="{{$msgSigningKey}}">{{ctx.AvatarUtils.Avatar $signingUser 16}}</span>
{{- else -}}
<span data-tooltip-content="{{$msgReason}}">{{svg "gitea-lock-cog"}}</span>
<span data-tooltip-content="{{$msgSigningKey}}">{{ctx.AvatarUtils.AvatarByEmail $signingEmail "" 16}}</span>
{{- end -}}
{{- else -}}
<span data-tooltip-content="{{$msgReason}}">{{svg "gitea-unlock"}}</span>
{{- end -}}
</span>
{{- if $commit -}}
</a>
{{- end -}}
{{- /* This template should be kept as small as possbile, DO NOT put large components like modal/dialog into it. */ -}}

View File

@ -28,33 +28,15 @@
</div>
</td>
<td class="sha">
{{$class := "ui sha label"}}
{{if .Signature}}
{{$class = (print $class " isSigned")}}
{{if .Verification.Verified}}
{{if eq .Verification.TrustStatus "trusted"}}
{{$class = (print $class " isVerified")}}
{{else if eq .Verification.TrustStatus "untrusted"}}
{{$class = (print $class " isVerifiedUntrusted")}}
{{else}}
{{$class = (print $class " isVerifiedUnmatched")}}
{{end}}
{{else if .Verification.Warning}}
{{$class = (print $class " isWarning")}}
{{end}}
{{end}}
{{$commitShaLink := ""}}
{{$commitBaseLink := ""}}
{{if $.PageIsWiki}}
{{$commitShaLink = (printf "%s/wiki/commit/%s" $commitRepoLink (PathEscape .ID.String))}}
{{$commitBaseLink = printf "%s/wiki/commit" $commitRepoLink}}
{{else if $.PageIsPullCommits}}
{{$commitShaLink = (printf "%s/pulls/%d/commits/%s" $commitRepoLink $.Issue.Index (PathEscape .ID.String))}}
{{$commitBaseLink = printf "%s/pulls/%d/commits" $commitRepoLink $.Issue.Index}}
{{else if $.Reponame}}
{{$commitShaLink = (printf "%s/commit/%s" $commitRepoLink (PathEscape .ID.String))}}
{{$commitBaseLink = printf "%s/commit" $commitRepoLink}}
{{end}}
<a {{if $commitShaLink}}href="{{$commitShaLink}}"{{end}} class="{{$class}}">
<span class="shortsha">{{ShortSha .ID.String}}</span>
{{if .Signature}}{{template "repo/shabox_badge" dict "root" $ "verification" .Verification}}{{end}}
</a>
{{template "repo/commit_sign_badge" dict "Commit" . "CommitBaseLink" $commitBaseLink "CommitSignVerification" .Verification}}
</td>
<td class="message">
<span class="message-wrapper">

View File

@ -3,7 +3,7 @@
{{range .comment.Commits}}
{{$tag := printf "%s-%d" $.comment.HashTag $index}}
{{$index = Eval $index "+" 1}}
<div class="singular-commit" id="{{$tag}}">
<div class="flex-text-block" id="{{$tag}}">{{/*singular-commit*/}}
<span class="badge badge-commit">{{svg "octicon-git-commit"}}</span>
{{if .User}}
<a class="avatar" href="{{.User.HomeLink}}">{{ctx.AvatarUtils.Avatar .User 20}}</a>
@ -11,7 +11,8 @@
{{ctx.AvatarUtils.AvatarByEmail .Author.Email .Author.Name 20}}
{{end}}
{{$commitLink:= printf "%s/commit/%s" $.comment.Issue.PullRequest.BaseRepo.Link (PathEscape .ID.String)}}
{{$commitBaseLink := printf "%s/commit" $.comment.Issue.PullRequest.BaseRepo.Link}}
{{$commitLink:= printf "%s/%s" $commitBaseLink (PathEscape .ID.String)}}
<span class="tw-flex-1 tw-font-mono gt-ellipsis" title="{{.Summary}}">
{{- ctx.RenderUtils.RenderCommitMessageLinkSubject .Message $commitLink ($.comment.Issue.PullRequest.BaseRepo.ComposeMetas ctx) -}}
@ -21,29 +22,9 @@
<button class="ui button ellipsis-button show-panel toggle" data-panel="[data-singular-commit-body-for='{{$tag}}']">...</button>
{{end}}
<span class="shabox tw-flex tw-items-center">
<span class="tw-flex tw-items-center tw-gap-2">
{{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses}}
{{$class := "ui sha label"}}
{{if .Signature}}
{{$class = (print $class " isSigned")}}
{{if .Verification.Verified}}
{{if eq .Verification.TrustStatus "trusted"}}
{{$class = (print $class " isVerified")}}
{{else if eq .Verification.TrustStatus "untrusted"}}
{{$class = (print $class " isVerifiedUntrusted")}}
{{else}}
{{$class = (print $class " isVerifiedUnmatched")}}
{{end}}
{{else if .Verification.Warning}}
{{$class = (print $class " isWarning")}}
{{end}}
{{end}}
<a href="{{$commitLink}}" rel="nofollow" class="tw-ml-2 {{$class}}">
<span class="shortsha">{{ShortSha .ID.String}}</span>
{{if .Signature}}
{{template "repo/shabox_badge" dict "root" $.root "verification" .Verification}}
{{end}}
</a>
{{template "repo/commit_sign_badge" dict "Commit" . "CommitBaseLink" $commitBaseLink "CommitSignVerification" .Verification}}
</span>
</div>
{{if IsMultilineCommitMessage .Message}}

View File

@ -1,5 +1,7 @@
{{$file := .file}}
{{$blobExcerptLink := print (or ctx.RootData.CommitRepoLink ctx.RootData.RepoLink) (Iif $.root.PageIsWiki "/wiki" "") "/blob_excerpt/" (PathEscape $.root.AfterCommitID) "?"}}
{{$repoLink := or ctx.RootData.CommitRepoLink ctx.RootData.RepoLink}}
{{$afterCommitID := or $.root.AfterCommitID "no-after-commit-id"}}{{/* this tmpl is also used by the PR Conversation page, so the "AfterCommitID" may not exist */}}
{{$blobExcerptLink := print $repoLink (Iif $.root.PageIsWiki "/wiki" "") "/blob_excerpt/" (PathEscape $afterCommitID) "?"}}
<colgroup>
<col width="50">
<col width="50">

View File

@ -5,33 +5,13 @@
{{if $commit.OnlyRelation}}
<span></span>
{{else}}
<span class="sha" id="{{$commit.ShortRev}}">
{{$class := "ui sha label"}}
{{if $commit.Commit.Signature}}
{{$class = (print $class " isSigned")}}
{{if $commit.Verification.Verified}}
{{if eq $commit.Verification.TrustStatus "trusted"}}
{{$class = (print $class " isVerified")}}
{{else if eq $commit.Verification.TrustStatus "untrusted"}}
{{$class = (print $class " isVerifiedUntrusted")}}
{{else}}
{{$class = (print $class " isVerifiedUnmatched")}}
{{end}}
{{else if $commit.Verification.Warning}}
{{$class = (print $class " isWarning")}}
{{end}}
{{end}}
<a href="{{$.RepoLink}}/commit/{{$commit.Rev|PathEscape}}" rel="nofollow" class="{{$class}}">
<span class="shortsha">{{ShortSha $commit.Commit.ID.String}}</span>
{{- if $commit.Commit.Signature -}}
{{template "repo/shabox_badge" dict "root" $ "verification" $commit.Verification}}
{{- end -}}
</a>
</span>
<span class="message tw-inline-block gt-ellipsis tw-mr-2">
{{template "repo/commit_sign_badge" dict "Commit" $commit.Commit "CommitBaseLink" (print $.RepoLink "/commit") "CommitSignVerification" $commit.Verification}}
<span class="message tw-inline-block gt-ellipsis">
<span>{{ctx.RenderUtils.RenderCommitMessage $commit.Subject ($.Repository.ComposeMetas ctx)}}</span>
</span>
<span class="commit-refs tw-flex tw-items-center tw-mr-1">
<span class="commit-refs flex-text-inline">
{{range $commit.Refs}}
{{$refGroup := .RefGroup}}
{{if eq $refGroup "pull"}}
@ -56,7 +36,8 @@
{{end}}
{{end}}
</span>
<span class="author tw-flex tw-items-center tw-mr-2 tw-gap-1">
<span class="author flex-text-inline">
{{$userName := $commit.Commit.Author.Name}}
{{if $commit.User}}
{{if and $commit.User.FullName DefaultShowFullName}}
@ -69,7 +50,8 @@
{{$userName}}
{{end}}
</span>
<span class="time tw-flex tw-items-center">{{DateUtils.FullTime $commit.Date}}</span>
<span class="time flex-text-inline">{{DateUtils.FullTime $commit.Date}}</span>
{{end}}
</li>
{{end}}

View File

@ -1,3 +1,4 @@
<div class="latest-commit">
{{if not .LatestCommit}}
{{else}}
@ -14,13 +15,11 @@
<span class="author-wrapper" title="{{.LatestCommit.Author.Name}}"><strong>{{.LatestCommit.Author.Name}}</strong></span>
{{end}}
{{end}}
<a rel="nofollow" class="ui sha label {{if .LatestCommit.Signature}} isSigned {{if .LatestCommitVerification.Verified}} isVerified{{if eq .LatestCommitVerification.TrustStatus "trusted"}}{{else if eq .LatestCommitVerification.TrustStatus "untrusted"}}Untrusted{{else}}Unmatched{{end}}{{else if .LatestCommitVerification.Warning}} isWarning{{end}}{{end}}" href="{{.RepoLink}}/commit/{{PathEscape .LatestCommit.ID.String}}">
<span class="shortsha">{{ShortSha .LatestCommit.ID.String}}</span>
{{if .LatestCommit.Signature}}
{{template "repo/shabox_badge" dict "root" $ "verification" .LatestCommitVerification}}
{{end}}
</a>
{{template "repo/commit_sign_badge" dict "Commit" .LatestCommit "CommitBaseLink" (print .RepoLink "/commit") "CommitSignVerification" .LatestCommitVerification}}
{{template "repo/commit_statuses" dict "Status" .LatestCommitStatus "Statuses" .LatestCommitStatuses}}
{{$commitLink:= printf "%s/commit/%s" .RepoLink (PathEscape .LatestCommit.ID.String)}}
<span class="grey commit-summary" title="{{.LatestCommit.Summary}}"><span class="message-wrapper">{{ctx.RenderUtils.RenderCommitMessageLinkSubject .LatestCommit.Message $commitLink ($.Repository.ComposeMetas ctx)}}</span>
{{if IsMultilineCommitMessage .LatestCommit.Message}}
@ -29,3 +28,4 @@
{{end}}
</span>
{{end}}
</div>

View File

@ -1,15 +0,0 @@
<div class="ui detail icon button">
{{if .verification.Verified}}
<div title="{{if eq .verification.TrustStatus "trusted"}}{{else if eq .verification.TrustStatus "untrusted"}}{{ctx.Locale.Tr "repo.commits.signed_by_untrusted_user"}}: {{else}}{{ctx.Locale.Tr "repo.commits.signed_by_untrusted_user_unmatched"}}: {{end}}{{.verification.Reason}}">
{{if ne .verification.SigningUser.ID 0}}
{{svg "gitea-lock"}}
{{ctx.AvatarUtils.Avatar .verification.SigningUser 16 "signature"}}
{{else}}
<span title="{{ctx.Locale.Tr "gpg.default_key"}}">{{svg "gitea-lock-cog"}}</span>
{{ctx.AvatarUtils.AvatarByEmail .verification.SigningEmail "" 16 "signature"}}
{{end}}
</div>
{{else}}
<span title="{{ctx.Locale.Tr .verification.Reason}}">{{svg "gitea-unlock"}}</span>
{{end}}
</div>

View File

@ -12,9 +12,7 @@
{{if not .ReadmeInList}}
<div id="repo-file-commit-box" class="ui segment list-header tw-mb-4 tw-flex tw-justify-between">
<div class="latest-commit">
{{template "repo/latest_commit" .}}
</div>
{{template "repo/latest_commit" .}}
{{if .LatestCommit}}
{{if .LatestCommit.Committer}}
<div class="text grey age">

View File

@ -1,7 +1,7 @@
{{/* use grid layout, still use the old ID because there are many other CSS styles depending on this ID */}}
<div id="repo-files-table" {{if .HasFilesWithoutLatestCommit}}hx-indicator="#repo-files-table .repo-file-cell.message" hx-trigger="load" hx-swap="morph" hx-post="{{.LastCommitLoaderURL}}"{{end}}>
<div class="repo-file-line repo-file-last-commit">
<div class="latest-commit">{{template "repo/latest_commit" .}}</div>
{{template "repo/latest_commit" .}}
<div>{{if and .LatestCommit .LatestCommit.Committer}}{{DateUtils.TimeSince .LatestCommit.Committer.When}}{{end}}</div>
</div>
{{if .HasParentPath}}