Skip to content

Commit 7679c66

Browse files
committed
Change commit page signature indication to icon only
1 parent 934fa46 commit 7679c66

File tree

7 files changed

+154
-188
lines changed

7 files changed

+154
-188
lines changed

Diff for: options/locale/locale_en-US.ini

+3
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ confirm_delete_artifact = Are you sure you want to delete the artifact '%s' ?
129129

130130
archived = Archived
131131

132+
sig_verified = Signed with user's verified signature
133+
sig_failed = Unable to verify this signature
134+
132135
concept_system_global = Global
133136
concept_user_individual = Individual
134137
concept_code_repository = Repository

Diff for: templates/repo/commit_page.tmpl

+3-92
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,7 @@
22
<div role="main" aria-label="{{.Title}}" class="page-content repository diff">
33
{{template "repo/header" .}}
44
<div class="ui container fluid padded">
5-
{{$class := ""}}
6-
{{if .Commit.Signature}}
7-
{{$class = (print $class " isSigned")}}
8-
{{if .Verification.Verified}}
9-
{{if eq .Verification.TrustStatus "trusted"}}
10-
{{$class = (print $class " isVerified")}}
11-
{{else if eq .Verification.TrustStatus "untrusted"}}
12-
{{$class = (print $class " isVerifiedUntrusted")}}
13-
{{else}}
14-
{{$class = (print $class " isVerifiedUnmatched")}}
15-
{{end}}
16-
{{else if .Verification.Warning}}
17-
{{$class = (print $class " isWarning")}}
18-
{{end}}
19-
{{end}}
20-
<div class="ui top attached header clearing segment tw-relative commit-header {{$class}}">
5+
<div class="ui top attached header clearing segment tw-relative commit-header">
216
<div class="tw-flex tw-mb-4 tw-flex-wrap">
227
<h3 class="tw-mb-0 tw-flex-1"><span class="commit-summary" title="{{.Commit.Summary}}">{{RenderCommitMessage $.Context .Commit.Message ($.Repository.ComposeMetas ctx)}}</span>{{template "repo/commit_statuses" dict "Status" .CommitStatus "Statuses" .CommitStatuses}}</h3>
238
{{if not $.PageIsWiki}}
@@ -139,7 +124,7 @@
139124
{{end}}
140125
{{template "repo/commit_load_branches_and_tags" .}}
141126
</div>
142-
<div class="ui attached segment tw-flex tw-items-center tw-justify-between tw-py-1 commit-header-row tw-flex-wrap {{$class}}">
127+
<div class="ui attached segment tw-flex tw-items-center tw-justify-between tw-py-1 commit-header-row tw-flex-wrap">
143128
<div class="tw-flex tw-items-center author">
144129
{{if .Author}}
145130
{{ctx.AvatarUtils.Avatar .Author 28 "tw-mr-2"}}
@@ -163,6 +148,7 @@
163148
<strong>{{.Commit.Committer.Name}}</strong>
164149
{{end}}
165150
{{end}}
151+
{{template "shared/verifyicon" .}}
166152
</div>
167153
<div class="ui horizontal list tw-flex tw-items-center">
168154
{{if .Parents}}
@@ -183,81 +169,6 @@
183169
</div>
184170
</div>
185171
</div>
186-
{{if .Commit.Signature}}
187-
<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}}">
188-
<div class="tw-flex tw-items-center">
189-
{{if .Verification.Verified}}
190-
{{if ne .Verification.SigningUser.ID 0}}
191-
{{svg "gitea-lock" 16 "tw-mr-2"}}
192-
{{if eq .Verification.TrustStatus "trusted"}}
193-
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.signed_by"}}:</span>
194-
{{else if eq .Verification.TrustStatus "untrusted"}}
195-
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.signed_by_untrusted_user"}}:</span>
196-
{{else}}
197-
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.signed_by_untrusted_user_unmatched"}}:</span>
198-
{{end}}
199-
{{ctx.AvatarUtils.Avatar .Verification.SigningUser 28 "tw-mr-2"}}
200-
<a href="{{.Verification.SigningUser.HomeLink}}"><strong>{{.Verification.SigningUser.GetDisplayName}}</strong></a>
201-
{{else}}
202-
<span title="{{ctx.Locale.Tr "gpg.default_key"}}">{{svg "gitea-lock-cog" 16 "tw-mr-2"}}</span>
203-
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.signed_by"}}:</span>
204-
{{ctx.AvatarUtils.AvatarByEmail .Verification.SigningEmail "" 28 "tw-mr-2"}}
205-
<strong>{{.Verification.SigningUser.GetDisplayName}}</strong>
206-
{{end}}
207-
{{else}}
208-
{{svg "gitea-unlock" 16 "tw-mr-2"}}
209-
<span class="ui text">{{ctx.Locale.Tr .Verification.Reason}}</span>
210-
{{end}}
211-
</div>
212-
<div class="tw-flex tw-items-center">
213-
{{if .Verification.Verified}}
214-
{{if ne .Verification.SigningUser.ID 0}}
215-
{{svg "octicon-verified" 16 "tw-mr-2"}}
216-
{{if .Verification.SigningSSHKey}}
217-
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
218-
{{.Verification.SigningSSHKey.Fingerprint}}
219-
{{else}}
220-
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span>
221-
{{.Verification.SigningKey.PaddedKeyID}}
222-
{{end}}
223-
{{else}}
224-
{{svg "octicon-unverified" 16 "tw-mr-2"}}
225-
{{if .Verification.SigningSSHKey}}
226-
<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>
227-
{{.Verification.SigningSSHKey.Fingerprint}}
228-
{{else}}
229-
<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>
230-
{{.Verification.SigningKey.PaddedKeyID}}
231-
{{end}}
232-
{{end}}
233-
{{else if .Verification.Warning}}
234-
{{svg "octicon-unverified" 16 "tw-mr-2"}}
235-
{{if .Verification.SigningSSHKey}}
236-
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
237-
{{.Verification.SigningSSHKey.Fingerprint}}
238-
{{else}}
239-
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span>
240-
{{.Verification.SigningKey.PaddedKeyID}}
241-
{{end}}
242-
{{else}}
243-
{{if .Verification.SigningKey}}
244-
{{if ne .Verification.SigningKey.KeyID ""}}
245-
{{svg "octicon-verified" 16 "tw-mr-2"}}
246-
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span>
247-
{{.Verification.SigningKey.PaddedKeyID}}
248-
{{end}}
249-
{{end}}
250-
{{if .Verification.SigningSSHKey}}
251-
{{if ne .Verification.SigningSSHKey.Fingerprint ""}}
252-
{{svg "octicon-verified" 16 "tw-mr-2"}}
253-
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
254-
{{.Verification.SigningSSHKey.Fingerprint}}
255-
{{end}}
256-
{{end}}
257-
{{end}}
258-
</div>
259-
</div>
260-
{{end}}
261172
{{if .NoteRendered}}
262173
<div class="ui top attached header segment git-notes">
263174
{{svg "octicon-note" 16 "tw-mr-2"}}

Diff for: templates/repo/pulls/status.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Template Attributes:
99

1010
{{if .CommitStatus}}
1111
<div class="commit-status-panel">
12-
<div class="ui top attached header commit-status-header">
12+
<div class="ui top attached header">
1313
{{if or (eq .CommitStatus.State "pending") (.MissingRequiredChecks)}}
1414
{{ctx.Locale.Tr "repo.pulls.status_checking"}}
1515
{{else if eq .CommitStatus.State "success"}}

Diff for: templates/shared/verifyicon.tmpl

+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
{{/*
2+
Template Attributes:
3+
* Commit: Commit object
4+
* Verification: Verification struct
5+
*/}}
6+
{{if (and .Commit .Commit.Signature .Verification)}}
7+
{{$icon := ""}}
8+
{{$text := ""}}
9+
{{$colorClass := ""}}
10+
{{if .Verification.Verified}}
11+
{{$icon = "octicon-verified"}}
12+
{{if eq .Verification.TrustStatus "trusted"}}
13+
{{$colorClass = "tw-text-green"}}
14+
{{$text = (ctx.Locale.Tr "sig_verified")}}
15+
{{else if eq .Verification.TrustStatus "untrusted"}}
16+
{{$colorClass = "tw-text-orange"}}
17+
{{$text = (ctx.Locale.Tr "repo.commits.signed_by_untrusted_user")}}
18+
{{else}}
19+
{{$colorClass = "tw-text-orange"}}
20+
{{$text = (ctx.Locale.Tr "repo.commits.signed_by_untrusted_user_unmatched")}}
21+
{{end}}
22+
{{else}}
23+
{{$icon = "octicon-unverified"}}
24+
{{if .Verification.Warning}}
25+
{{$colorClass = "tw-text-red"}}
26+
{{else}}
27+
{{$colorClass = "tw-text-inherit"}}
28+
{{end}}
29+
{{if .Verification.Reason}}
30+
{{$text = (ctx.Locale.Tr .Verification.Reason)}}
31+
{{else}}
32+
{{$text = (ctx.Locale.Tr "sig_failed")}}
33+
{{end}}
34+
{{end}}
35+
<button
36+
class="btn interact-bg tippy-trigger tw-ml-1 tw-p-2"
37+
data-tippy-theme="box-with-header"
38+
data-tippy-role="dialog"
39+
data-tippy-trigger="click"
40+
data-tippy-interactive="true"
41+
data-tippy-hideOnClick="true"
42+
>
43+
{{svg $icon 16 $colorClass}}
44+
</button>
45+
<div class="tippy-target">
46+
<div class="verification-status-panel">
47+
<div class="ui top attached header">
48+
{{svg $icon 16 (printf "%s tw-mr-1" $colorClass)}} {{$text}}
49+
</div>
50+
<div class="tw-flex tw-flex-col">
51+
{{if .Verification.Verified}}
52+
<div class="tw-flex tw-items-center tw-px-3 tw-py-2">
53+
{{if ne .Verification.SigningUser.ID 0}}
54+
{{if eq .Verification.TrustStatus "trusted"}}
55+
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.signed_by"}}:</span>
56+
{{else if eq .Verification.TrustStatus "untrusted"}}
57+
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.signed_by_untrusted_user"}}:</span>
58+
{{else}}
59+
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.signed_by_untrusted_user_unmatched"}}:</span>
60+
{{end}}
61+
{{ctx.AvatarUtils.Avatar .Verification.SigningUser 28 "tw-mr-2"}}
62+
<a href="{{.Verification.SigningUser.HomeLink}}"><strong>{{.Verification.SigningUser.GetDisplayName}}</strong></a>
63+
{{else}}
64+
<span title="{{ctx.Locale.Tr "gpg.default_key"}}">
65+
{{svg "gitea-lock-cog" 16 "tw-mr-2"}}</span>
66+
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.signed_by"}}:</span>
67+
{{ctx.AvatarUtils.AvatarByEmail .Verification.SigningEmail "" 28 "tw-mr-2"}}
68+
<strong>{{.Verification.SigningUser.GetDisplayName}}</strong>
69+
{{end}}
70+
</div>
71+
{{end}}
72+
<div class="tw-flex tw-items-center tw-px-3 tw-py-2">
73+
{{if .Verification.Verified}}
74+
{{if ne .Verification.SigningUser.ID 0}}
75+
{{if .Verification.SigningSSHKey}}
76+
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
77+
<span class="tw-font-mono">{{.Verification.SigningSSHKey.Fingerprint}}</span>
78+
{{else}}
79+
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span>
80+
<span class="tw-font-mono">{{.Verification.SigningKey.PaddedKeyID}}</span>
81+
{{end}}
82+
{{else}}
83+
{{if .Verification.SigningSSHKey}}
84+
<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>
85+
<span class="tw-font-mono">{{.Verification.SigningSSHKey.Fingerprint}}</span>
86+
{{else}}
87+
<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>
88+
<span class="tw-font-mono">{{.Verification.SigningKey.PaddedKeyID}}</span>
89+
{{end}}
90+
{{end}}
91+
{{else if .Verification.Warning}}
92+
{{if .Verification.SigningSSHKey}}
93+
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
94+
<span class="tw-font-mono">{{.Verification.SigningSSHKey.Fingerprint}}</span>
95+
{{else}}
96+
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span>
97+
<span class="tw-font-mono">{{.Verification.SigningKey.PaddedKeyID}}</span>
98+
{{end}}
99+
{{else}}
100+
{{if .Verification.SigningKey}}
101+
{{if ne .Verification.SigningKey.KeyID ""}}
102+
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.gpg_key_id"}}:</span>
103+
<span class="tw-font-mono">{{.Verification.SigningKey.PaddedKeyID}}</span>
104+
{{end}}
105+
{{end}}
106+
{{if .Verification.SigningSSHKey}}
107+
{{if ne .Verification.SigningSSHKey.Fingerprint ""}}
108+
<span class="ui text tw-mr-2">{{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}:</span>
109+
<span class="tw-font-mono">{{.Verification.SigningSSHKey.Fingerprint}}</span>
110+
{{end}}
111+
{{end}}
112+
{{end}}
113+
</div>
114+
</div>
115+
</div>
116+
</div>
117+
{{end}}

Diff for: web_src/css/modules/tippy.css

+10
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383

8484
.tippy-box[data-theme="box-with-header"] {
8585
box-shadow: 0 6px 18px var(--color-shadow);
86+
color: var(--color-text);
8687
}
8788

8889
.tippy-box[data-theme="box-with-header"] .tippy-content {
@@ -99,6 +100,15 @@
99100
fill: var(--color-box-header);
100101
}
101102

103+
.tippy-box[data-theme="box-with-header"] .ui.top.attached.header {
104+
/* reset the default ".ui.attached.header" styles, to use the outer border */
105+
border: none !important;
106+
/* add a bottom border to make sure the there is always a divider between the header and list when the list is scrolling */
107+
border-bottom: 1px solid var(--color-secondary) !important;
108+
/* use negative margin to avoid the newly added border conflict with the list's top border */
109+
margin: 0 0 -1px !important;
110+
}
111+
102112
.tippy-box[data-placement^="top"] > .tippy-svg-arrow {
103113
bottom: 0;
104114
}

Diff for: web_src/css/repo.css

-95
Original file line numberDiff line numberDiff line change
@@ -1789,92 +1789,6 @@
17891789
padding-top: 0;
17901790
}
17911791

1792-
.repository .ui.attached.isSigned.isWarning {
1793-
border-left: 1px solid var(--color-error-border);
1794-
border-right: 1px solid var(--color-error-border);
1795-
}
1796-
1797-
.repository .ui.attached.isSigned.isWarning.top,
1798-
.repository .ui.attached.isSigned.isWarning.message {
1799-
border-top: 1px solid var(--color-error-border);
1800-
}
1801-
1802-
.repository .ui.attached.isSigned.isWarning.message {
1803-
box-shadow: none;
1804-
background-color: var(--color-error-bg);
1805-
color: var(--color-error-text);
1806-
}
1807-
1808-
.repository .ui.attached.isSigned.isWarning.message .ui.text {
1809-
color: var(--color-error-text);
1810-
}
1811-
1812-
.repository .ui.attached.isSigned.isWarning:last-child,
1813-
.repository .ui.attached.isSigned.isWarning.bottom {
1814-
border-bottom: 1px solid var(--color-error-border);
1815-
}
1816-
1817-
.repository .ui.attached.isSigned.isVerified {
1818-
border-left: 1px solid var(--color-success-border);
1819-
border-right: 1px solid var(--color-success-border);
1820-
}
1821-
1822-
.repository .ui.attached.isSigned.isVerified.top,
1823-
.repository .ui.attached.isSigned.isVerified.message {
1824-
border-top: 1px solid var(--color-success-border);
1825-
}
1826-
1827-
.repository .ui.attached.isSigned.isVerified.message {
1828-
box-shadow: none;
1829-
background-color: var(--color-success-bg);
1830-
color: var(--color-success-text);
1831-
}
1832-
1833-
.repository .ui.attached.isSigned.isVerified.message .pull-right {
1834-
color: var(--color-text);
1835-
}
1836-
1837-
.repository .ui.attached.isSigned.isVerified.message .ui.text {
1838-
color: var(--color-success-text);
1839-
}
1840-
1841-
.repository .ui.attached.isSigned.isVerified:last-child,
1842-
.repository .ui.attached.isSigned.isVerified.bottom {
1843-
border-bottom: 1px solid var(--color-success-border);
1844-
}
1845-
1846-
.repository .ui.attached.isSigned.isVerifiedUntrusted,
1847-
.repository .ui.attached.isSigned.isVerifiedUnmatched {
1848-
border-left: 1px solid var(--color-warning-border);
1849-
border-right: 1px solid var(--color-warning-border);
1850-
}
1851-
1852-
.repository .ui.attached.isSigned.isVerifiedUntrusted.top,
1853-
.repository .ui.attached.isSigned.isVerifiedUnmatched.top,
1854-
.repository .ui.attached.isSigned.isVerifiedUntrusted.message,
1855-
.repository .ui.attached.isSigned.isVerifiedUnmatched.message {
1856-
border-top: 1px solid var(--color-warning-border);
1857-
}
1858-
1859-
.repository .ui.attached.isSigned.isVerifiedUntrusted.message,
1860-
.repository .ui.attached.isSigned.isVerifiedUnmatched.message {
1861-
box-shadow: none;
1862-
background-color: var(--color-warning-bg);
1863-
color: var(--color-warning-text);
1864-
}
1865-
1866-
.repository .ui.attached.isSigned.isVerifiedUntrusted.message .ui.text,
1867-
.repository .ui.attached.isSigned.isVerifiedUnmatched.message .ui.text {
1868-
color: var(--color-warning-text);
1869-
}
1870-
1871-
.repository .ui.attached.isSigned.isVerifiedUntrusted:last-child,
1872-
.repository .ui.attached.isSigned.isVerifiedUnmatched:last-child,
1873-
.repository .ui.attached.isSigned.isVerifiedUntrusted.bottom,
1874-
.repository .ui.attached.isSigned.isVerifiedUnmatched.bottom {
1875-
border-bottom: 1px solid var(--color-warning-border);
1876-
}
1877-
18781792
.repository .segment.reactions.dropdown .menu,
18791793
.repository .select-reaction.dropdown .menu {
18801794
right: 0 !important;
@@ -2815,15 +2729,6 @@ tbody.commit-list {
28152729
}
28162730
}
28172731

2818-
.commit-status-header {
2819-
/* reset the default ".ui.attached.header" styles, to use the outer border */
2820-
border: none !important;
2821-
/* add a bottom border to make sure the there is always a divider between the header and list when the list is scrolling */
2822-
border-bottom: 1px solid var(--color-secondary) !important;
2823-
/* use negative margin to avoid the newly added border conflict with the list's top border */
2824-
margin: 0 0 -1px !important;
2825-
}
2826-
28272732
.commit-status-list {
28282733
max-height: 240px; /* fit exactly 6 items, commit-status-item.height * 6 */
28292734
overflow-x: hidden;

0 commit comments

Comments
 (0)