@@ -10,31 +10,29 @@ export const triggerNativeNotifications = (
1010 newNotifications : AccountNotifications [ ] ,
1111 state : GitifyState ,
1212) => {
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+ ) ;
2019
21- if ( ! accountPreviousNotifications ) {
22- return accountNotifications . notifications ;
23- }
20+ if ( ! accountPreviousNotifications ) {
21+ return accountNotifications . notifications ;
22+ }
2423
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+ ) ;
2827
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+ ) ;
3433
35- return accountNewNotifications ;
36- } )
37- . reduce ( ( acc , val ) => acc . concat ( val ) , [ ] ) ;
34+ return accountNewNotifications ;
35+ } ) ;
3836
3937 setTrayIconColor ( newNotifications ) ;
4038
@@ -63,7 +61,7 @@ export const raiseNativeNotification = (notifications: Notification[]) => {
6361 ? ''
6462 : notification . repository . full_name ;
6563 body = notification . subject . title ;
66- // TODO FIXME = set url to notification url
64+ // url intentionally left null (no direct subject URL available)
6765 } else {
6866 title = APPLICATION . NAME ;
6967 body = `You have ${ notifications . length } notifications` ;
0 commit comments