Skip to content

Commit 41e2a21

Browse files
committed
refactor(api): use @octokit/types REST schema type
Signed-off-by: Adam Setch <[email protected]>
1 parent 3974f95 commit 41e2a21

File tree

2 files changed

+8
-27
lines changed

2 files changed

+8
-27
lines changed

src/renderer/utils/notifications/handlers/commit.ts

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,27 +39,18 @@ class CommitHandler extends DefaultHandler {
3939
)
4040
).data;
4141

42-
user = commitComment.user
43-
? {
44-
login: commitComment.user.login,
45-
html_url: commitComment.user.html_url,
46-
avatar_url: commitComment.user.avatar_url,
47-
type: commitComment.user.type,
48-
}
49-
: null;
42+
user = commitComment.user;
5043
} else {
5144
const commit = (
5245
await getCommit(notification.subject.url, notification.account.token)
5346
).data;
5447

55-
user = commit.author
56-
? {
57-
login: commit.author.login,
58-
html_url: commit.author.html_url,
59-
avatar_url: commit.author.avatar_url,
60-
type: commit.author.type,
61-
}
62-
: null;
48+
user = {
49+
login: commit.author.login,
50+
avatar_url: commit.author.avatar_url,
51+
html_url: commit.author.html_url,
52+
type: commit.author.type,
53+
};
6354
}
6455

6556
return {

src/renderer/utils/notifications/handlers/release.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { TagIcon } from '@primer/octicons-react';
55

66
import type {
77
GitifyNotificationState,
8-
GitifyNotificationUser,
98
GitifySubject,
109
Link,
1110
SettingsState,
@@ -34,18 +33,9 @@ class ReleaseHandler extends DefaultHandler {
3433
await getRelease(notification.subject.url, notification.account.token)
3534
).data;
3635

37-
const releaseAuthor: GitifyNotificationUser = release.author
38-
? {
39-
login: release.author.login,
40-
html_url: release.author.html_url,
41-
avatar_url: release.author.avatar_url,
42-
type: release.author.type,
43-
}
44-
: null;
45-
4636
return {
4737
state: releaseState,
48-
user: getNotificationAuthor([releaseAuthor]),
38+
user: getNotificationAuthor([release.author]),
4939
};
5040
}
5141

0 commit comments

Comments
 (0)