diff options
author | Cirno the Strongest <1447794+CirnoT@users.noreply.github.com> | 2020-06-03 02:22:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-02 20:22:26 -0400 |
commit | d0a18a12704360c06cf48b586956148a17a4505a (patch) | |
tree | ff3e08b375af392162784c2a2a10daf2f6109b35 | |
parent | a1ad188326f9af633d2be0920a140275a4972bfe (diff) | |
download | gitea-d0a18a12704360c06cf48b586956148a17a4505a.tar.gz gitea-d0a18a12704360c06cf48b586956148a17a4505a.zip |
Show full GPG commit status on PR commit history (#11702)
* Show full GPG commit status on PR commit history
* move shabox badge to separate template
* unnecessary $
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
-rw-r--r-- | templates/repo/commits_list.tmpl | 19 | ||||
-rw-r--r-- | templates/repo/commits_list_small.tmpl | 21 | ||||
-rw-r--r-- | templates/repo/issue/view_content/comments.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/shabox_badge.tmpl | 18 | ||||
-rw-r--r-- | templates/repo/view_list.tmpl | 19 | ||||
-rw-r--r-- | web_src/less/_repository.less | 3 |
6 files changed, 35 insertions, 47 deletions
diff --git a/templates/repo/commits_list.tmpl b/templates/repo/commits_list.tmpl index ad2369c042..e5c4c7488d 100644 --- a/templates/repo/commits_list.tmpl +++ b/templates/repo/commits_list.tmpl @@ -48,24 +48,7 @@ {{end}} <span class="shortsha">{{ShortSha .ID.String}}</span> {{if .Signature}} - <div class="ui detail icon button"> - {{if .Verification.Verified}} - <div title="{{if eq .Verification.TrustStatus "trusted"}}{{else if eq .Verification.TrustStatus "untrusted"}}{{$.i18n.Tr "repo.commits.signed_by_untrusted_user"}}: {{else}}{{$.i18n.Tr "repo.commits.signed_by_untrusted_user_unmatched"}}: {{end}}{{.Verification.Reason}}"> - {{if ne .Verification.SigningUser.ID 0}} - <i class="lock icon"></i> - <img class="ui signature avatar image" src="{{.Verification.SigningUser.RelAvatarLink}}" /> - {{else}} - <i title="{{.Verification.Reason}}" class="icons"> - <i class="lock icon"></i> - <i class="tiny inverted cog icon centerlock"></i> - </i> - <img class="ui signature avatar image" src="{{AvatarLink .Verification.SigningEmail}}" /> - {{end}} - </div> - {{else}} - <i title="{{$.i18n.Tr .Verification.Reason}}" class="unlock icon"></i> - {{end}} - </div> + {{template "repo/shabox_badge" dict "root" $ "verification" .Verification}} {{end}} {{if $.Reponame}} </a> diff --git a/templates/repo/commits_list_small.tmpl b/templates/repo/commits_list_small.tmpl index e5634bbad2..26b6aa211c 100644 --- a/templates/repo/commits_list_small.tmpl +++ b/templates/repo/commits_list_small.tmpl @@ -1,8 +1,8 @@ -{{ $r:= List .Commits}} +{{ $r:= List .comment.Commits}} {{ $index := 0}} <div class="timeline-item commits-list"> {{range $r}} - {{ $tag := printf "%s-%d" $.HashTag $index }} + {{ $tag := printf "%s-%d" $.comment.HashTag $index }} {{ $index = Add $index 1}} <div class="singular-commit" id="{{$tag}}"> <span class="badge badge-commit">{{svg "octicon-git-commit" 16}}</span> @@ -31,13 +31,16 @@ {{$class = (printf "%s%s" $class " isWarning")}} {{end}} {{end}} - {{if $.Issue.PullRequest.BaseRepo.Name}} - <a href="{{AppSubUrl}}/{{$.Issue.PullRequest.BaseRepo.OwnerName}}/{{$.Issue.PullRequest.BaseRepo.Name}}/commit/{{.ID}}" rel="nofollow" class="{{$class}}"> + {{if $.comment.Issue.PullRequest.BaseRepo.Name}} + <a href="{{AppSubUrl}}/{{$.comment.Issue.PullRequest.BaseRepo.OwnerName}}/{{$.comment.Issue.PullRequest.BaseRepo.Name}}/commit/{{.ID}}" rel="nofollow" class="{{$class}}"> {{else}} <span class="{{$class}}"> {{end}} - <span class="shortsha">{{ShortSha .ID.String}}</span> - {{if $.Issue.PullRequest.BaseRepo.Name}} + <span class="shortsha">{{ShortSha .ID.String}}</span> + {{if .Signature}} + {{template "repo/shabox_badge" dict "root" $.root "verification" .Verification}} + {{end}} + {{if $.comment.Issue.PullRequest.BaseRepo.Name}} </a> {{else}} </span> @@ -45,14 +48,14 @@ </span> <span class="message-wrapper"> - {{ $commitLink:= printf "%s/%s/%s/commit/%s" AppSubUrl $.Issue.PullRequest.BaseRepo.OwnerName $.Issue.PullRequest.BaseRepo.Name .ID }} - <span class="mono commit-summary has-emoji{{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{RenderCommitMessageLinkSubject .Message ($.Issue.PullRequest.BaseRepo.Link|Escape) $commitLink $.Issue.PullRequest.BaseRepo.ComposeMetas}}</span> + {{ $commitLink:= printf "%s/%s/%s/commit/%s" AppSubUrl $.comment.Issue.PullRequest.BaseRepo.OwnerName $.comment.Issue.PullRequest.BaseRepo.Name .ID }} + <span class="mono commit-summary{{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{RenderCommitMessageLinkSubject .Message ($.comment.Issue.PullRequest.BaseRepo.Link|Escape) $commitLink $.comment.Issue.PullRequest.BaseRepo.ComposeMetas}}</span> </span> {{if IsMultilineCommitMessage .Message}} <button class="basic compact mini ui icon button commit-button"><i class="ellipsis horizontal icon"></i></button> {{end}} {{if IsMultilineCommitMessage .Message}} - <pre class="commit-body" style="display: none;">{{RenderCommitBody .Message ($.Issue.PullRequest.BaseRepo.Link|Escape) $.Issue.PullRequest.BaseRepo.ComposeMetas}}</pre> + <pre class="commit-body" style="display: none;">{{RenderCommitBody .Message ($.comment.Issue.PullRequest.BaseRepo.Link|Escape) $.comment.Issue.PullRequest.BaseRepo.ComposeMetas}}</pre> {{end}} </div> {{end}} diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index fcec8f6bae..b227061109 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -608,7 +608,7 @@ </span> </div> {{if not .IsForcePush}} - {{template "repo/commits_list_small" .}} + {{template "repo/commits_list_small" dict "comment" . "root" $}} {{end}} {{end}} {{end}} diff --git a/templates/repo/shabox_badge.tmpl b/templates/repo/shabox_badge.tmpl new file mode 100644 index 0000000000..f4bd30fdb1 --- /dev/null +++ b/templates/repo/shabox_badge.tmpl @@ -0,0 +1,18 @@ +<div class="ui detail icon button"> + {{if .verification.Verified}} + <div title="{{if eq .verification.TrustStatus "trusted"}}{{else if eq .verification.TrustStatus "untrusted"}}{{$.root.i18n.Tr "repo.commits.signed_by_untrusted_user"}}: {{else}}{{$.root.i18n.Tr "repo.commits.signed_by_untrusted_user_unmatched"}}: {{end}}{{.verification.Reason}}"> + {{if ne .verification.SigningUser.ID 0}} + <i class="lock icon"></i> + <img class="ui signature avatar image" src="{{.verification.SigningUser.RelAvatarLink}}" /> + {{else}} + <i title="{{.verification.Reason}}" class="icons"> + <i class="lock icon"></i> + <i class="tiny inverted cog icon centerlock"></i> + </i> + <img class="ui signature avatar image" src="{{AvatarLink .verification.SigningEmail}}" /> + {{end}} + </div> + {{else}} + <i title="{{$.root.i18n.Tr .verification.Reason}}" class="unlock icon"></i> + {{end}} +</div> diff --git a/templates/repo/view_list.tmpl b/templates/repo/view_list.tmpl index 2add12577d..3362e28939 100644 --- a/templates/repo/view_list.tmpl +++ b/templates/repo/view_list.tmpl @@ -18,24 +18,7 @@ <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/{{.LatestCommit.ID}}"> <span class="shortsha">{{ShortSha .LatestCommit.ID.String}}</span> {{if .LatestCommit.Signature}} - <div class="ui detail icon button"> - {{if .LatestCommitVerification.Verified}} - <div title="{{if eq .LatestCommitVerification.TrustStatus "trusted"}}{{else if eq .LatestCommitVerification.TrustStatus "untrusted"}}{{.i18n.Tr "repo.commits.signed_by_untrusted_user"}}: {{else}}{{.i18n.Tr "repo.commits.signed_by_untrusted_user_unmatched"}}: {{end}}{{.LatestCommitVerification.Reason}}"> - {{if ne .LatestCommitVerification.SigningUser.ID 0}} - <i class="lock icon"></i> - <img class="ui signature avatar image" src="{{.LatestCommitVerification.SigningUser.RelAvatarLink}}" /> - {{else}} - <i title="{{.LatestCommitVerification.Reason}}" class="icons"> - <i class="lock icon"></i> - <i class="tiny inverted cog icon centerlock"></i> - </i> - <img class="ui signature avatar image" src="{{AvatarLink .LatestCommitVerification.SigningEmail}}" /> - {{end}} - </div> - {{else}} - <i title="{{$.i18n.Tr .LatestCommitVerification.Reason}}" class="unlock icon"></i> - {{end}} - </div> + {{template "repo/shabox_badge" dict "root" $ "verification" .LatestCommitVerification}} {{end}} </a> {{template "repo/commit_status" .LatestCommitStatus}} diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index efb89d5adf..b387d16079 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -1427,7 +1427,8 @@ } #commits-table td.sha .sha.label, - #repo-files-table .sha.label { + #repo-files-table .sha.label, + .timeline-item.commits-list .singular-commit .sha.label { border: 1px solid #bbbbbb; .ui.signature.avatar { |