Skip to content

Commit 5348e8b

Browse files
committed
Fix color: closed PR was showing as purple instead of red
1 parent 27d30f1 commit 5348e8b

File tree

4 files changed

+37
-23
lines changed

4 files changed

+37
-23
lines changed

models/issue.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,16 @@ func (issue *Issue) loadRepo(e Engine) (err error) {
9393
return nil
9494
}
9595

96+
// GetPullRequest returns the issue pull request
97+
func (issue *Issue) GetPullRequest() (pr *PullRequest, err error) {
98+
if !issue.IsPull {
99+
return nil, fmt.Errorf("Issue is not a pull request")
100+
}
101+
102+
pr, err = getPullRequestByIssueID(x, issue.ID)
103+
return
104+
}
105+
96106
func (issue *Issue) loadAttributes(e Engine) (err error) {
97107
if err := issue.loadRepo(e); err != nil {
98108
return err
@@ -953,9 +963,9 @@ func Issues(opts *IssuesOptions) ([]*Issue, error) {
953963

954964
switch opts.IsPull {
955965
case util.OptionalBoolTrue:
956-
sess.And("issue.is_pull=?",true)
966+
sess.And("issue.is_pull=?", true)
957967
case util.OptionalBoolFalse:
958-
sess.And("issue.is_pull=?",false)
968+
sess.And("issue.is_pull=?", false)
959969
}
960970

961971
sortIssuesSession(sess, opts.SortType)
@@ -1780,4 +1790,3 @@ func DeleteMilestoneByRepoID(repoID, id int64) error {
17801790
}
17811791
return sess.Commit()
17821792
}
1783-

public/css/index.css

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2726,17 +2726,16 @@ footer .ui.language .menu {
27262726
.user.notification table tr {
27272727
cursor: pointer;
27282728
}
2729-
.user.notification .octicon-issue-opened,
2730-
.user.notification .octicon-git-pull-request {
2729+
.user.notification .octicon.green {
27312730
color: #21ba45;
27322731
}
2733-
.user.notification .octicon-issue-closed {
2732+
.user.notification .octicon.red {
27342733
color: #d01919;
27352734
}
2736-
.user.notification .octicon-git-merge {
2735+
.user.notification .octicon.purple {
27372736
color: #a333c8;
27382737
}
2739-
.user.notification .octicon-pin {
2738+
.user.notification .octicon.blue {
27402739
color: #2185d0;
27412740
}
27422741
.dashboard {

public/less/_user.less

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,19 @@
9999
}
100100
}
101101

102-
.octicon-issue-opened, .octicon-git-pull-request {
103-
color: #21ba45;
104-
}
105-
.octicon-issue-closed {
106-
color: #d01919;
107-
}
108-
.octicon-git-merge {
109-
color: #a333c8;
110-
}
111-
.octicon-pin {
112-
color: #2185d0;
102+
.octicon {
103+
&.green {
104+
color: #21ba45;
105+
}
106+
&.red {
107+
color: #d01919;
108+
}
109+
&.purple {
110+
color: #a333c8;
111+
}
112+
&.blue {
113+
color: #2185d0;
114+
}
113115
}
114116
}
115117
}

templates/user/notification/notification.tmpl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,19 @@
4040
<i class="blue octicon octicon-pin"></i>
4141
{{else if $issue.IsPull}}
4242
{{if $issue.IsClosed}}
43-
<i class="octicon octicon-git-merge"></i>
43+
{{if $issue.GetPullRequest.HasMerged}}
44+
<i class="purple octicon octicon-git-merge"></i>
45+
{{else}}
46+
<i class="red octicon octicon-git-pull-request"></i>
47+
{{end}}
4448
{{else}}
45-
<i class="octicon octicon-git-pull-request"></i>
49+
<i class="green octicon octicon-git-pull-request"></i>
4650
{{end}}
4751
{{else}}
4852
{{if $issue.IsClosed}}
49-
<i class="octicon octicon-issue-closed"></i>
53+
<i class="red octicon octicon-issue-closed"></i>
5054
{{else}}
51-
<i class="octicon octicon-issue-opened"></i>
55+
<i class="green octicon octicon-issue-opened"></i>
5256
{{end}}
5357
{{end}}
5458
</td>

0 commit comments

Comments
 (0)