Skip to content

Commit f685edf

Browse files
a1012112796lunnyjolheiserguillep2k
authored
Change review status icons on PR view style to Github style (#10737)
* change the icon of ApproveReview pr from "eye" to "check" like github * change the icon of RejectReview pr from "x" to "request-change" like github * add "-" after "{{" which need to be one line (TODO: may be not change all) Signed-off-by: a1012112796 <[email protected]> Co-authored-by: Lunny Xiao <[email protected]> Co-authored-by: John Olheiser <[email protected]> Co-authored-by: guillep2k <[email protected]>
1 parent 3723b06 commit f685edf

File tree

4 files changed

+25
-22
lines changed

4 files changed

+25
-22
lines changed

models/review.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ const (
3333
func (rt ReviewType) Icon() string {
3434
switch rt {
3535
case ReviewTypeApprove:
36-
return "eye"
36+
return "check"
3737
case ReviewTypeReject:
38-
return "x"
39-
case ReviewTypeComment, ReviewTypeUnknown:
38+
return "request-changes"
39+
case ReviewTypeComment:
4040
return "comment"
4141
default:
4242
return "comment"

models/review_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ func TestReview_LoadCodeComments(t *testing.T) {
4444
}
4545

4646
func TestReviewType_Icon(t *testing.T) {
47-
assert.Equal(t, "eye", ReviewTypeApprove.Icon())
48-
assert.Equal(t, "x", ReviewTypeReject.Icon())
47+
assert.Equal(t, "check", ReviewTypeApprove.Icon())
48+
assert.Equal(t, "request-changes", ReviewTypeReject.Icon())
4949
assert.Equal(t, "comment", ReviewTypeComment.Icon())
5050
assert.Equal(t, "comment", ReviewTypeUnknown.Icon())
5151
assert.Equal(t, "comment", ReviewType(4).Icon())

templates/repo/issue/view_content/comments.tmpl

+4-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,10 @@
318318
</div>
319319
{{else if eq .Type 22}}
320320
<div class="event" id="{{.HashTag}}">
321-
<span class="issue-symbol">{{svg (printf "octicon-%s" .Review.Type.Icon) 16}}</span>
321+
<span class="issue-symbol {{if eq .Review.Type 1}}green
322+
{{- else if eq .Review.Type 2}}grey
323+
{{- else if eq .Review.Type 3}}red
324+
{{- else}}grey{{end}}">{{svg (printf "octicon-%s" .Review.Type.Icon) 16}}</span>
322325
{{if .OriginalAuthor }}
323326
{{else}}
324327
<a class="ui avatar image"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>

templates/repo/issue/view_content/pull.tmpl

+16-16
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
<div class="ui divider"></div>
99
<div class="review-item">
1010
<span class="type-icon text {{if eq .Type 1}}green
11-
{{else if eq .Type 2}}grey
12-
{{else if eq .Type 3}}red
13-
{{else}}grey{{end}}">
11+
{{- else if eq .Type 2}}grey
12+
{{- else if eq .Type 3}}red
13+
{{- else}}grey{{end}}">
1414
{{svg (printf "octicon-%s" .Type.Icon) 16}}
1515
</span>
1616
{{if .Stale}}
@@ -40,19 +40,19 @@
4040
{{end}}
4141
<div class="comment merge box">
4242
<a class="avatar text
43-
{{if .Issue.PullRequest.HasMerged}}purple
44-
{{else if .Issue.IsClosed}}grey
45-
{{else if .IsPullWorkInProgress}}grey
46-
{{else if .IsFilesConflicted}}grey
47-
{{else if .IsPullRequestBroken}}red
48-
{{else if .IsBlockedByApprovals}}red
49-
{{else if .IsBlockedByRejection}}red
50-
{{else if and .EnableStatusCheck (or .RequiredStatusCheckState.IsFailure .RequiredStatusCheckState.IsError)}}red
51-
{{else if and .EnableStatusCheck (or .RequiredStatusCheckState.IsPending .RequiredStatusCheckState.IsWarning)}}yellow
52-
{{else if and .RequireSigned (not .WillSign)}}}red
53-
{{else if .Issue.PullRequest.IsChecking}}yellow
54-
{{else if .Issue.PullRequest.CanAutoMerge}}green
55-
{{else}}red{{end}}">{{svg "octicon-git-merge" 32}}</a>
43+
{{- if .Issue.PullRequest.HasMerged}}purple
44+
{{- else if .Issue.IsClosed}}grey
45+
{{- else if .IsPullWorkInProgress}}grey
46+
{{- else if .IsFilesConflicted}}grey
47+
{{- else if .IsPullRequestBroken}}red
48+
{{- else if .IsBlockedByApprovals}}red
49+
{{- else if .IsBlockedByRejection}}red
50+
{{- else if and .EnableStatusCheck (or .RequiredStatusCheckState.IsFailure .RequiredStatusCheckState.IsError)}}red
51+
{{- else if and .EnableStatusCheck (or .RequiredStatusCheckState.IsPending .RequiredStatusCheckState.IsWarning)}}yellow
52+
{{- else if and .RequireSigned (not .WillSign)}}}red
53+
{{- else if .Issue.PullRequest.IsChecking}}yellow
54+
{{- else if .Issue.PullRequest.CanAutoMerge}}green
55+
{{- else}}red{{end}}">{{svg "octicon-git-merge" 32}}</a>
5656
<div class="content">
5757
{{template "repo/pulls/status" .}}
5858
<div class="ui {{if not $.LatestCommitStatus}}top attached header{{else}}attached merge-section segment{{end}}">

0 commit comments

Comments
 (0)