From d0a18a12704360c06cf48b586956148a17a4505a Mon Sep 17 00:00:00 2001 From: Cirno the Strongest <1447794+CirnoT@users.noreply.github.com> Date: Wed, 3 Jun 2020 02:22:26 +0200 Subject: [PATCH] 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 Co-authored-by: Lauris BH --- templates/repo/commits_list.tmpl | 19 +---------------- templates/repo/commits_list_small.tmpl | 21 +++++++++++-------- .../repo/issue/view_content/comments.tmpl | 2 +- templates/repo/shabox_badge.tmpl | 18 ++++++++++++++++ templates/repo/view_list.tmpl | 19 +---------------- web_src/less/_repository.less | 3 ++- 6 files changed, 35 insertions(+), 47 deletions(-) create mode 100644 templates/repo/shabox_badge.tmpl diff --git a/templates/repo/commits_list.tmpl b/templates/repo/commits_list.tmpl index ad2369c04..e5c4c7488 100644 --- a/templates/repo/commits_list.tmpl +++ b/templates/repo/commits_list.tmpl @@ -48,24 +48,7 @@ {{end}} {{ShortSha .ID.String}} {{if .Signature}} -
- {{if .Verification.Verified}} -
- {{if ne .Verification.SigningUser.ID 0}} - - - {{else}} - - - - - - {{end}} -
- {{else}} - - {{end}} -
+ {{template "repo/shabox_badge" dict "root" $ "verification" .Verification}} {{end}} {{if $.Reponame}} diff --git a/templates/repo/commits_list_small.tmpl b/templates/repo/commits_list_small.tmpl index e5634bbad..26b6aa211 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}}
{{range $r}} - {{ $tag := printf "%s-%d" $.HashTag $index }} + {{ $tag := printf "%s-%d" $.comment.HashTag $index }} {{ $index = Add $index 1}}
{{svg "octicon-git-commit" 16}} @@ -31,13 +31,16 @@ {{$class = (printf "%s%s" $class " isWarning")}} {{end}} {{end}} - {{if $.Issue.PullRequest.BaseRepo.Name}} - + {{if $.comment.Issue.PullRequest.BaseRepo.Name}} + {{else}} {{end}} - {{ShortSha .ID.String}} - {{if $.Issue.PullRequest.BaseRepo.Name}} + {{ShortSha .ID.String}} + {{if .Signature}} + {{template "repo/shabox_badge" dict "root" $.root "verification" .Verification}} + {{end}} + {{if $.comment.Issue.PullRequest.BaseRepo.Name}} {{else}} @@ -45,14 +48,14 @@ - {{ $commitLink:= printf "%s/%s/%s/commit/%s" AppSubUrl $.Issue.PullRequest.BaseRepo.OwnerName $.Issue.PullRequest.BaseRepo.Name .ID }} - {{RenderCommitMessageLinkSubject .Message ($.Issue.PullRequest.BaseRepo.Link|Escape) $commitLink $.Issue.PullRequest.BaseRepo.ComposeMetas}} + {{ $commitLink:= printf "%s/%s/%s/commit/%s" AppSubUrl $.comment.Issue.PullRequest.BaseRepo.OwnerName $.comment.Issue.PullRequest.BaseRepo.Name .ID }} + {{RenderCommitMessageLinkSubject .Message ($.comment.Issue.PullRequest.BaseRepo.Link|Escape) $commitLink $.comment.Issue.PullRequest.BaseRepo.ComposeMetas}} {{if IsMultilineCommitMessage .Message}} {{end}} {{if IsMultilineCommitMessage .Message}} - + {{end}}
{{end}} diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index fcec8f6ba..b22706110 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -608,7 +608,7 @@
{{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 000000000..f4bd30fdb --- /dev/null +++ b/templates/repo/shabox_badge.tmpl @@ -0,0 +1,18 @@ +
+ {{if .verification.Verified}} +
+ {{if ne .verification.SigningUser.ID 0}} + + + {{else}} + + + + + + {{end}} +
+ {{else}} + + {{end}} +
diff --git a/templates/repo/view_list.tmpl b/templates/repo/view_list.tmpl index 2add12577..3362e2893 100644 --- a/templates/repo/view_list.tmpl +++ b/templates/repo/view_list.tmpl @@ -18,24 +18,7 @@ {{ShortSha .LatestCommit.ID.String}} {{if .LatestCommit.Signature}} -
- {{if .LatestCommitVerification.Verified}} -
- {{if ne .LatestCommitVerification.SigningUser.ID 0}} - - - {{else}} - - - - - - {{end}} -
- {{else}} - - {{end}} -
+ {{template "repo/shabox_badge" dict "root" $ "verification" .LatestCommitVerification}} {{end}}
{{template "repo/commit_status" .LatestCommitStatus}} diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index efb89d5ad..b387d1607 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 {