@@ -13,33 +13,43 @@ export function filterNotifications(
1313 settings : SettingsState ,
1414) : Notification [ ] {
1515 return notifications . filter ( ( notification ) => {
16+ let passesFilters = true ;
17+
1618 if ( settings . detailedNotifications ) {
1719 if ( hasUserTypeFilters ( settings ) ) {
18- return settings . filterUserTypes . some ( ( userType ) =>
19- filterNotificationByUserType ( notification , userType ) ,
20- ) ;
20+ passesFilters =
21+ passesFilters &&
22+ settings . filterUserTypes . some ( ( userType ) =>
23+ filterNotificationByUserType ( notification , userType ) ,
24+ ) ;
2125 }
2226
2327 if ( hasIncludeHandleFilters ( settings ) ) {
24- return settings . filterIncludeHandles . some ( ( handle ) =>
25- filterNotificationByHandle ( notification , handle ) ,
26- ) ;
28+ passesFilters =
29+ passesFilters &&
30+ settings . filterIncludeHandles . some ( ( handle ) =>
31+ filterNotificationByHandle ( notification , handle ) ,
32+ ) ;
2733 }
2834
2935 if ( hasExcludeHandleFilters ( settings ) ) {
30- return ! settings . filterExcludeHandles . some ( ( handle ) =>
31- filterNotificationByHandle ( notification , handle ) ,
32- ) ;
36+ passesFilters =
37+ passesFilters &&
38+ ! settings . filterExcludeHandles . some ( ( handle ) =>
39+ filterNotificationByHandle ( notification , handle ) ,
40+ ) ;
3341 }
3442 }
3543
3644 if ( hasReasonFilters ( settings ) ) {
37- return settings . filterReasons . some ( ( reason ) =>
38- filterNotificationByReason ( notification , reason ) ,
39- ) ;
45+ passesFilters =
46+ passesFilters &&
47+ settings . filterReasons . some ( ( reason ) =>
48+ filterNotificationByReason ( notification , reason ) ,
49+ ) ;
4050 }
4151
42- return true ;
52+ return passesFilters ;
4353 } ) ;
4454}
4555
0 commit comments