Skip to content

Commit 7b85744

Browse files
committed
fix
1 parent b1585f4 commit 7b85744

File tree

1 file changed

+30
-29
lines changed

1 file changed

+30
-29
lines changed

templates/repo/commit_sign_badge.tmpl

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,47 +9,48 @@ so this template should be kept as small as possbile, DO NOT put large component
99
{{- $commit := $.Commit -}}
1010
{{- $commitBaseLink := $.CommitBaseLink -}}
1111
{{- $verification := $.CommitSignVerification -}}
12+
1213
{{- $extraClass := "" -}}
1314
{{- $verified := false -}}
14-
{{- $trusted := false -}}
1515
{{- $signingUser := NIL -}}
1616
{{- $signingEmail := "" -}}
1717
{{- $msgReasonPrefix := "" -}}
1818
{{- $msgReason := "" -}}
1919
{{- $msgSigningKey := "" -}}
2020

21-
{{- $signingUser = $verification.SigningUser -}}
22-
{{- $signingEmail = $verification.SigningEmail -}}
23-
{{- $extraClass = print $extraClass " commit-is-signed" -}}
24-
{{- if $verification.Verified -}}
25-
{{- /* reason is "{name} / {key-id}" */ -}}
26-
{{- $msgReason = $verification.Reason -}}
27-
{{- $verified = true -}}
28-
{{- if eq $verification.TrustStatus "trusted" -}}
29-
{{- $extraClass = print $extraClass " sign-trusted" -}}
30-
{{- $trusted = true -}}
31-
{{- else if eq $verification.TrustStatus "untrusted" -}}
32-
{{- $extraClass = print $extraClass " sign-untrusted" -}}
33-
{{- $msgReasonPrefix = ctx.Locale.Tr "repo.commits.signed_by_untrusted_user" -}}
21+
{{- if $verification -}}
22+
{{- $signingUser = $verification.SigningUser -}}
23+
{{- $signingEmail = $verification.SigningEmail -}}
24+
{{- $extraClass = print $extraClass " commit-is-signed" -}}
25+
{{- if $verification.Verified -}}
26+
{{- /* reason is "{name} / {key-id}" */ -}}
27+
{{- $msgReason = $verification.Reason -}}
28+
{{- $verified = true -}}
29+
{{- if eq $verification.TrustStatus "trusted" -}}
30+
{{- $extraClass = print $extraClass " sign-trusted" -}}
31+
{{- else if eq $verification.TrustStatus "untrusted" -}}
32+
{{- $extraClass = print $extraClass " sign-untrusted" -}}
33+
{{- $msgReasonPrefix = ctx.Locale.Tr "repo.commits.signed_by_untrusted_user" -}}
34+
{{- else -}}
35+
{{- $extraClass = print $extraClass " sign-unmatched" -}}
36+
{{- $msgReasonPrefix = ctx.Locale.Tr "repo.commits.signed_by_untrusted_user_unmatched" -}}
37+
{{- end -}}
3438
{{- else -}}
35-
{{- $extraClass = print $extraClass " sign-unmatched" -}}
36-
{{- $msgReasonPrefix = ctx.Locale.Tr "repo.commits.signed_by_untrusted_user_unmatched" -}}
37-
{{- end -}}
38-
{{- else -}}
39-
{{- if $verification.Warning -}}
40-
{{- $extraClass = print $extraClass " sign-warning" -}}
39+
{{- if $verification.Warning -}}
40+
{{- $extraClass = print $extraClass " sign-warning" -}}
41+
{{- end -}}
42+
{{- $msgReason = ctx.Locale.Tr $verification.Reason -}}{{- /* dirty part: it is the translation key ..... */ -}}
4143
{{- end -}}
42-
{{- $msgReason = ctx.Locale.Tr $verification.Reason -}}{{- /* dirty part: it is the translation key ..... */ -}}
43-
{{- end -}}
4444

45-
{{- if $msgReasonPrefix -}}
46-
{{- $msgReason = print $msgReasonPrefix ": " $msgReason -}}
47-
{{- end -}}
45+
{{- if $msgReasonPrefix -}}
46+
{{- $msgReason = print $msgReasonPrefix ": " $msgReason -}}
47+
{{- end -}}
4848

49-
{{- if $verification.SigningSSHKey -}}
50-
{{- $msgSigningKey = print (ctx.Locale.Tr "repo.commits.ssh_key_fingerprint") ": " $verification.SigningSSHKey.Fingerprint -}}
51-
{{- else if $verification.SigningKey -}}
52-
{{- $msgSigningKey = print (ctx.Locale.Tr "repo.commits.gpg_key_id") ": " $verification.SigningKey.PaddedKeyID -}}
49+
{{- if $verification.SigningSSHKey -}}
50+
{{- $msgSigningKey = print (ctx.Locale.Tr "repo.commits.ssh_key_fingerprint") ": " $verification.SigningSSHKey.Fingerprint -}}
51+
{{- else if $verification.SigningKey -}}
52+
{{- $msgSigningKey = print (ctx.Locale.Tr "repo.commits.gpg_key_id") ": " $verification.SigningKey.PaddedKeyID -}}
53+
{{- end -}}
5354
{{- end -}}
5455

5556
{{- if $commit -}}

0 commit comments

Comments
 (0)