File tree Expand file tree Collapse file tree 3 files changed +53
-3
lines changed Expand file tree Collapse file tree 3 files changed +53
-3
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,10 @@ export const NotificationRow: React.FC<IProps> = ({
49
49
} ;
50
50
51
51
const reason = formatReason ( notification . reason ) ;
52
- const NotificationIcon = getNotificationTypeIcon ( notification . subject . type ) ;
52
+ const NotificationIcon = getNotificationTypeIcon (
53
+ notification . subject . type ,
54
+ notification . subject . state ,
55
+ ) ;
53
56
const iconColor = getNotificationTypeIconColor ( notification . subject . state ) ;
54
57
const realIconColor = settings
55
58
? ( settings . colors && iconColor ) || ''
Original file line number Diff line number Diff line change @@ -27,9 +27,30 @@ describe('./utils/github-api.ts', () => {
27
27
expect ( getNotificationTypeIcon ( 'Issue' ) . displayName ) . toBe (
28
28
'IssueOpenedIcon' ,
29
29
) ;
30
+ expect ( getNotificationTypeIcon ( 'Issue' , 'draft' ) . displayName ) . toBe (
31
+ 'IssueDraftIcon' ,
32
+ ) ;
33
+ expect ( getNotificationTypeIcon ( 'Issue' , 'closed' ) . displayName ) . toBe (
34
+ 'IssueClosedIcon' ,
35
+ ) ;
36
+ expect ( getNotificationTypeIcon ( 'Issue' , 'completed' ) . displayName ) . toBe (
37
+ 'IssueClosedIcon' ,
38
+ ) ;
39
+ expect ( getNotificationTypeIcon ( 'Issue' , 'reopened' ) . displayName ) . toBe (
40
+ 'IssueReopenedIcon' ,
41
+ ) ;
30
42
expect ( getNotificationTypeIcon ( 'PullRequest' ) . displayName ) . toBe (
31
43
'GitPullRequestIcon' ,
32
44
) ;
45
+ expect ( getNotificationTypeIcon ( 'PullRequest' , 'draft' ) . displayName ) . toBe (
46
+ 'GitPullRequestDraftIcon' ,
47
+ ) ;
48
+ expect ( getNotificationTypeIcon ( 'PullRequest' , 'closed' ) . displayName ) . toBe (
49
+ 'GitPullRequestClosedIcon' ,
50
+ ) ;
51
+ expect ( getNotificationTypeIcon ( 'PullRequest' , 'merged' ) . displayName ) . toBe (
52
+ 'GitMergeIcon' ,
53
+ ) ;
33
54
expect ( getNotificationTypeIcon ( 'Release' ) . displayName ) . toBe ( 'TagIcon' ) ;
34
55
expect (
35
56
getNotificationTypeIcon ( 'RepositoryVulnerabilityAlert' ) . displayName ,
Original file line number Diff line number Diff line change @@ -2,8 +2,14 @@ import {
2
2
AlertIcon ,
3
3
CommentDiscussionIcon ,
4
4
GitCommitIcon ,
5
+ GitMergeIcon ,
6
+ GitPullRequestClosedIcon ,
7
+ GitPullRequestDraftIcon ,
5
8
GitPullRequestIcon ,
9
+ IssueClosedIcon ,
10
+ IssueDraftIcon ,
6
11
IssueOpenedIcon ,
12
+ IssueReopenedIcon ,
7
13
MailIcon ,
8
14
OcticonProps ,
9
15
QuestionIcon ,
@@ -66,6 +72,7 @@ export function formatReason(reason: Reason): {
66
72
67
73
export function getNotificationTypeIcon (
68
74
type : SubjectType ,
75
+ state ?: StateType ,
69
76
) : React . FC < OcticonProps > {
70
77
switch ( type ) {
71
78
case 'CheckSuite' :
@@ -75,9 +82,28 @@ export function getNotificationTypeIcon(
75
82
case 'Discussion' :
76
83
return CommentDiscussionIcon ;
77
84
case 'Issue' :
78
- return IssueOpenedIcon ;
85
+ switch ( state ) {
86
+ case 'draft' :
87
+ return IssueDraftIcon ;
88
+ case 'closed' :
89
+ case 'completed' :
90
+ return IssueClosedIcon ;
91
+ case 'reopened' :
92
+ return IssueReopenedIcon ;
93
+ default :
94
+ return IssueOpenedIcon ;
95
+ }
79
96
case 'PullRequest' :
80
- return GitPullRequestIcon ;
97
+ switch ( state ) {
98
+ case 'draft' :
99
+ return GitPullRequestDraftIcon ;
100
+ case 'closed' :
101
+ return GitPullRequestClosedIcon ;
102
+ case 'merged' :
103
+ return GitMergeIcon ;
104
+ default :
105
+ return GitPullRequestIcon ;
106
+ }
81
107
case 'Release' :
82
108
return TagIcon ;
83
109
case 'RepositoryInvitation' :
You can’t perform that action at this time.
0 commit comments