MCPcopy Index your code
hub / github.com/gitify-app/gitify / enrich

Method enrich

src/renderer/utils/notifications/handlers/commit.ts:21–64  ·  view source on GitHub ↗
(
    notification: GitifyNotification,
    _settings: SettingsState,
  )

Source from the content-addressed store, hash-verified

19
20class CommitHandler extends DefaultHandler {
21 override async enrich(
22 notification: GitifyNotification,
23 _settings: SettingsState,
24 ): Promise<Partial<GitifySubject>> {
25 const commitState: GitifyNotificationState | undefined = undefined; // Commit notifications are stateless
26
27 // Return early if this notification would be hidden by filters
28 if (isStateFilteredOut(commitState)) {
29 return {};
30 }
31
32 let user: GitifyNotificationUser;
33
34 if (notification.subject.latestCommentUrl) {
35 const commitComment = await getCommitComment(
36 notification.account,
37 notification.subject.latestCommentUrl,
38 );
39
40 user = {
41 login: commitComment.user!.login,
42 avatarUrl: commitComment.user!.avatar_url as Link,
43 htmlUrl: commitComment.user!.html_url as Link,
44 type: commitComment.user!.type as GitifyNotificationUser['type'],
45 };
46 } else {
47 const commit = await getCommit(
48 notification.account,
49 notification.subject.url!,
50 );
51
52 user = {
53 login: commit.author!.login,
54 avatarUrl: commit.author!.avatar_url as Link,
55 htmlUrl: commit.author!.html_url as Link,
56 type: commit.author!.type as GitifyNotificationUser['type'],
57 };
58 }
59
60 return {
61 state: commitState,
62 user: getNotificationAuthor([user]),
63 };
64 }
65
66 override iconType(_notification: GitifyNotification): FC<OcticonProps> {
67 return GitCommitIcon;

Callers

nothing calls this directly

Calls 4

isStateFilteredOutFunction · 0.90
getCommitCommentFunction · 0.90
getCommitFunction · 0.90
getNotificationAuthorFunction · 0.90

Tested by

no test coverage detected