Skip to content

Commit 2e17dda

Browse files
lafriksappleboy
authored andcommitted
Remove sha1 hash display in repository table and add latest commit GPG check (#1678)
1 parent 935caa7 commit 2e17dda

File tree

4 files changed

+57
-33
lines changed

4 files changed

+57
-33
lines changed

public/css/index.css

+14-7
Original file line numberDiff line numberDiff line change
@@ -1306,6 +1306,9 @@ footer .ui.language .menu {
13061306
padding-top: 8px;
13071307
padding-bottom: 8px;
13081308
}
1309+
.repository.file.list #repo-files-table td.message .isSigned {
1310+
cursor: default;
1311+
}
13091312
.repository.file.list #repo-files-table tr:hover {
13101313
background-color: #ffffEE;
13111314
}
@@ -1933,27 +1936,31 @@ footer .ui.language .menu {
19331936
.repository #commits-table td.sha .sha.label {
19341937
margin: 0;
19351938
}
1936-
.repository #commits-table td.sha .sha.label.isSigned {
1939+
.repository #commits-table.ui.basic.striped.table tbody tr:nth-child(2n) {
1940+
background-color: rgba(0, 0, 0, 0.02) !important;
1941+
}
1942+
.repository #commits-table td.sha .sha.label.isSigned,
1943+
.repository #repo-files-table .sha.label.isSigned {
19371944
border: 1px solid #BBB;
19381945
}
1939-
.repository #commits-table td.sha .sha.label.isSigned .detail.icon {
1946+
.repository #commits-table td.sha .sha.label.isSigned .detail.icon,
1947+
.repository #repo-files-table .sha.label.isSigned .detail.icon {
19401948
background: #FAFAFA;
19411949
margin: -6px -10px -4px 0px;
19421950
padding: 5px 3px 5px 6px;
19431951
border-left: 1px solid #BBB;
19441952
border-top-left-radius: 0;
19451953
border-bottom-left-radius: 0;
19461954
}
1947-
.repository #commits-table td.sha .sha.label.isSigned.isVerified {
1955+
.repository #commits-table td.sha .sha.label.isSigned.isVerified,
1956+
.repository #repo-files-table .sha.label.isSigned.isVerified {
19481957
border: 1px solid #21BA45;
19491958
background: #21BA4518;
19501959
}
1951-
.repository #commits-table td.sha .sha.label.isSigned.isVerified .detail.icon {
1960+
.repository #commits-table td.sha .sha.label.isSigned.isVerified .detail.icon,
1961+
.repository #repo-files-table .sha.label.isSigned.isVerified .detail.icon {
19521962
border-left: 1px solid #21BA4580;
19531963
}
1954-
.repository #commits-table.ui.basic.striped.table tbody tr:nth-child(2n) {
1955-
background-color: rgba(0, 0, 0, 0.02) !important;
1956-
}
19571964
.repository .diff-detail-box {
19581965
margin: 15px 0;
19591966
line-height: 30px;

public/less/_repository.less

+27-23
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@
204204
padding-top: 8px;
205205
padding-bottom: 8px;
206206
}
207+
td.message .isSigned {
208+
cursor: default;
209+
}
207210
tr:hover {
208211
background-color: #ffffEE;
209212
}
@@ -804,34 +807,35 @@
804807
width: 140px;
805808
}
806809
}
807-
td.sha{
808-
.sha.label{
809-
margin: 0;
810-
&.isSigned{
811-
border: 1px solid #BBB;
812-
.detail.icon{
813-
background: #FAFAFA;
814-
margin: -6px -10px -4px 0px;
815-
padding: 5px 3px 5px 6px;
816-
border-left: 1px solid #BBB;
817-
border-top-left-radius: 0;
818-
border-bottom-left-radius: 0;
819-
}
820-
}
821-
&.isSigned.isVerified{
822-
border: 1px solid #21BA45;
823-
background: #21BA4518;
824-
.detail.icon{
825-
border-left: 1px solid #21BA4580;
826-
}
827-
}
828-
}
829-
}
810+
td.sha .sha.label {
811+
margin: 0;
812+
}
830813
&.ui.basic.striped.table tbody tr:nth-child(2n) {
831814
background-color: rgba(0, 0, 0, .02)!important;
832815
}
833816
}
834817

818+
#commits-table td.sha .sha.label, #repo-files-table .sha.label{
819+
&.isSigned{
820+
border: 1px solid #BBB;
821+
.detail.icon{
822+
background: #FAFAFA;
823+
margin: -6px -10px -4px 0px;
824+
padding: 5px 3px 5px 6px;
825+
border-left: 1px solid #BBB;
826+
border-top-left-radius: 0;
827+
border-bottom-left-radius: 0;
828+
}
829+
}
830+
&.isSigned.isVerified{
831+
border: 1px solid #21BA45;
832+
background: #21BA4518;
833+
.detail.icon{
834+
border-left: 1px solid #21BA4580;
835+
}
836+
}
837+
}
838+
835839
.diff-detail-box {
836840
margin: 15px 0;
837841
line-height: 30px;

routers/repo/view.go

+1
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ func renderDirectory(ctx *context.Context, treeLink string) {
117117
}
118118
}
119119
ctx.Data["LatestCommit"] = latestCommit
120+
ctx.Data["LatestCommitVerification"] = models.ParseCommitWithSignature(latestCommit)
120121
ctx.Data["LatestCommitUser"] = models.ValidateCommitWithEmail(latestCommit)
121122

122123
// Check permission to add or upload new file.

templates/repo/view_list.tmpl

+15-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,18 @@
1313
<img class="ui avatar image img-12" src="{{AvatarLink .LatestCommit.Author.Email}}" />
1414
<strong>{{.LatestCommit.Author.Name}}</strong>
1515
{{end}}
16-
<a rel="nofollow" class="ui sha label" href="{{.RepoLink}}/commit/{{.LatestCommit.ID}}" rel="nofollow">{{ShortSha .LatestCommit.ID.String}}</a>
16+
<a rel="nofollow" class="ui sha label {{if .LatestCommit.Signature}} isSigned {{if .LatestCommitVerification.Verified }} isVerified {{end}}{{end}}" href="{{.RepoLink}}/commit/{{.LatestCommit.ID}}">
17+
{{ShortSha .LatestCommit.ID.String}}
18+
{{if .LatestCommit.Signature}}
19+
<div class="ui detail icon button">
20+
{{if .LatestCommitVerification.Verified}}
21+
<i title="{{.LatestCommitVerification.Reason}}" class="lock green icon"></i>
22+
{{else}}
23+
<i title="{{$.i18n.Tr .LatestCommitVerification.Reason}}" class="unlock icon"></i>
24+
{{end}}
25+
</div>
26+
{{end}}
27+
</a>
1728
<span class="grey has-emoji">{{RenderCommitMessage false .LatestCommit.Summary .RepoLink $.Repository.ComposeMetas}}</span>
1829
</th>
1930
<th class="nine wide">
@@ -61,8 +72,9 @@
6172
</td>
6273
{{end}}
6374
<td class="message collapsing has-emoji">
64-
<a rel="nofollow" class="ui sha label" href="{{$.RepoLink}}/commit/{{$commit.ID}}">{{ShortSha $commit.ID.String}}</a>
65-
{{RenderCommitMessage false $commit.Summary $.RepoLink $.Repository.ComposeMetas}}
75+
<a rel="nofollow" href="{{$.RepoLink}}/commit/{{$commit.ID}}">
76+
{{RenderCommitMessage false $commit.Summary $.RepoLink $.Repository.ComposeMetas}}
77+
</a>
6678
</td>
6779
<td class="text grey right age">{{TimeSince $commit.Committer.When $.Lang}}</td>
6880
</tr>

0 commit comments

Comments
 (0)