Skip to content

Commit ab10027

Browse files
authored
fix: add missing Discussions data (#438)
1 parent 0b06dca commit ab10027

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

src/js/utils/github-api.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@ describe('./utils/github-api.ts', () => {
1919
});
2020

2121
it('should get the notification type icon', () => {
22+
expect(getNotificationTypeIcon('CheckSuite')).toBe('sync');
23+
expect(getNotificationTypeIcon('Commit')).toBe('git-commit');
24+
expect(getNotificationTypeIcon('Discussion')).toBe('comment-discussion');
2225
expect(getNotificationTypeIcon('Issue')).toBe('issue-opened');
2326
expect(getNotificationTypeIcon('PullRequest')).toBe('git-pull-request');
24-
expect(getNotificationTypeIcon('Commit')).toBe('git-commit');
2527
expect(getNotificationTypeIcon('Release')).toBe('tag');
2628
expect(getNotificationTypeIcon('RepositoryVulnerabilityAlert')).toBe(
2729
'alert'
2830
);
29-
expect(getNotificationTypeIcon('CheckSuite')).toBe('sync');
3031
expect(getNotificationTypeIcon('Unknown' as SubjectType)).toBe('question');
3132
});
3233
});

src/js/utils/github-api.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,20 @@ export function formatReason(
5353

5454
export function getNotificationTypeIcon(type: SubjectType): string {
5555
switch (type) {
56+
case 'CheckSuite':
57+
return 'sync';
58+
case 'Commit':
59+
return 'git-commit';
60+
case 'Discussion':
61+
return 'comment-discussion';
5662
case 'Issue':
5763
return 'issue-opened';
5864
case 'PullRequest':
5965
return 'git-pull-request';
60-
case 'Commit':
61-
return 'git-commit';
6266
case 'Release':
6367
return 'tag';
6468
case 'RepositoryVulnerabilityAlert':
6569
return 'alert';
66-
case 'CheckSuite':
67-
return 'sync';
6870
default:
6971
return 'question';
7072
}

src/types/github.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ export type Reason =
1313
| 'ci_activity';
1414

1515
export type SubjectType =
16+
| 'CheckSuite'
17+
| 'Commit'
18+
| 'Discussion'
1619
| 'Issue'
1720
| 'PullRequest'
18-
| 'Commit'
1921
| 'Release'
20-
| 'CheckSuite'
2122
| 'RepositoryVulnerabilityAlert';
2223

2324
export interface Notification {

0 commit comments

Comments
 (0)