@@ -17,11 +17,13 @@ import { createNotificationHandler } from './handlers';
1717/**
1818 * Get the count of notifications across all accounts.
1919 *
20- * @param notifications - The account notifications to check.
20+ * @param accountNotifications - The account notifications to check.
2121 * @returns The count of all notifications.
2222 */
23- export function getNotificationCount ( notifications : AccountNotifications [ ] ) {
24- return notifications . reduce (
23+ export function getNotificationCount (
24+ accountNotifications : AccountNotifications [ ] ,
25+ ) {
26+ return accountNotifications . reduce (
2527 ( sum , account ) => sum + account . notifications . length ,
2628 0 ,
2729 ) ;
@@ -30,13 +32,13 @@ export function getNotificationCount(notifications: AccountNotifications[]) {
3032/**
3133 * Get the count of notifications across all accounts.
3234 *
33- * @param notifications - The account notifications to check.
35+ * @param accountNotifications - The account notifications to check.
3436 * @returns The count of unread notifications.
3537 */
3638export function getUnreadNotificationCount (
37- notifications : AccountNotifications [ ] ,
39+ accountNotifications : AccountNotifications [ ] ,
3840) {
39- return notifications . reduce (
41+ return accountNotifications . reduce (
4042 ( sum , account ) =>
4143 sum + account . notifications . filter ( ( n ) => n . unread === true ) . length ,
4244 0 ,
@@ -64,7 +66,7 @@ function getNotifications(state: GitifyState) {
6466export async function getAllNotifications (
6567 state : GitifyState ,
6668) : Promise < AccountNotifications [ ] > {
67- const notifications : AccountNotifications [ ] = await Promise . all (
69+ const accountNotifications : AccountNotifications [ ] = await Promise . all (
6870 getNotifications ( state )
6971 . filter ( ( response ) => ! ! response )
7072 . map ( async ( accountNotifications ) => {
@@ -113,9 +115,9 @@ export async function getAllNotifications(
113115 ) ;
114116
115117 // Set the order property for the notifications
116- stabilizeNotificationsOrder ( notifications , state . settings ) ;
118+ stabilizeNotificationsOrder ( accountNotifications , state . settings ) ;
117119
118- return notifications ;
120+ return accountNotifications ;
119121}
120122
121123export async function enrichNotifications (
@@ -178,23 +180,23 @@ export async function enrichNotification(
178180 * Assign an order property to each notification to stabilize how they are displayed
179181 * during notification interaction events (mark as read, mark as done, etc.)
180182 *
181- * @param notifications
183+ * @param accountNotifications
182184 * @param settings
183185 */
184186export function stabilizeNotificationsOrder (
185- notifications : AccountNotifications [ ] ,
187+ accountNotifications : AccountNotifications [ ] ,
186188 settings : SettingsState ,
187189) {
188190 let orderIndex = 0 ;
189191
190- for ( const account of notifications ) {
192+ for ( const account of accountNotifications ) {
191193 const flattenedNotifications = getFlattenedNotificationsByRepo (
192194 account . notifications ,
193195 settings ,
194196 ) ;
195197
196- for ( const n of flattenedNotifications ) {
197- n . order = orderIndex ++ ;
198+ for ( const notification of flattenedNotifications ) {
199+ notification . order = orderIndex ++ ;
198200 }
199201 }
200202}
0 commit comments