@@ -10,31 +10,29 @@ export const triggerNativeNotifications = (
10
10
newNotifications : AccountNotifications [ ] ,
11
11
state : GitifyState ,
12
12
) => {
13
- const diffNotifications = newNotifications
14
- . map ( ( accountNotifications ) => {
15
- const accountPreviousNotifications = previousNotifications . find (
16
- ( item ) =>
17
- getAccountUUID ( item . account ) ===
18
- getAccountUUID ( accountNotifications . account ) ,
19
- ) ;
13
+ const diffNotifications = newNotifications . flatMap ( ( accountNotifications ) => {
14
+ const accountPreviousNotifications = previousNotifications . find (
15
+ ( item ) =>
16
+ getAccountUUID ( item . account ) ===
17
+ getAccountUUID ( accountNotifications . account ) ,
18
+ ) ;
20
19
21
- if ( ! accountPreviousNotifications ) {
22
- return accountNotifications . notifications ;
23
- }
20
+ if ( ! accountPreviousNotifications ) {
21
+ return accountNotifications . notifications ;
22
+ }
24
23
25
- const accountPreviousNotificationsIds = new Set < string > (
26
- accountPreviousNotifications . notifications . map ( ( item ) => item . id ) ,
27
- ) ;
24
+ const accountPreviousNotificationsIds = new Set < string > (
25
+ accountPreviousNotifications . notifications . map ( ( item ) => item . id ) ,
26
+ ) ;
28
27
29
- const accountNewNotifications = accountNotifications . notifications . filter (
30
- ( item ) => {
31
- return ! accountPreviousNotificationsIds . has ( `${ item . id } ` ) ;
32
- } ,
33
- ) ;
28
+ const accountNewNotifications = accountNotifications . notifications . filter (
29
+ ( item ) => {
30
+ return ! accountPreviousNotificationsIds . has ( `${ item . id } ` ) ;
31
+ } ,
32
+ ) ;
34
33
35
- return accountNewNotifications ;
36
- } )
37
- . reduce ( ( acc , val ) => acc . concat ( val ) , [ ] ) ;
34
+ return accountNewNotifications ;
35
+ } ) ;
38
36
39
37
setTrayIconColor ( newNotifications ) ;
40
38
@@ -63,7 +61,7 @@ export const raiseNativeNotification = (notifications: Notification[]) => {
63
61
? ''
64
62
: notification . repository . full_name ;
65
63
body = notification . subject . title ;
66
- // TODO FIXME = set url to notification url
64
+ // url intentionally left null (no direct subject URL available)
67
65
} else {
68
66
title = APPLICATION . NAME ;
69
67
body = `You have ${ notifications . length } notifications` ;
0 commit comments