@@ -14,23 +14,31 @@ export function filterNotifications(
1414 settings : SettingsState ,
1515) : Notification [ ] {
1616 return notifications . filter ( ( notification ) => {
17+ let passesFilters = true ;
18+
1719 if ( settings . detailedNotifications ) {
1820 if ( hasUserTypeFilters ( settings ) ) {
19- return settings . filterUserTypes . some ( ( userType ) =>
20- filterNotificationByUserType ( notification , userType ) ,
21- ) ;
21+ passesFilters =
22+ passesFilters &&
23+ settings . filterUserTypes . some ( ( userType ) =>
24+ filterNotificationByUserType ( notification , userType ) ,
25+ ) ;
2226 }
2327
2428 if ( hasIncludeHandleFilters ( settings ) ) {
25- return settings . filterIncludeHandles . some ( ( handle ) =>
26- filterNotificationByHandle ( notification , handle ) ,
27- ) ;
29+ passesFilters =
30+ passesFilters &&
31+ settings . filterIncludeHandles . some ( ( handle ) =>
32+ filterNotificationByHandle ( notification , handle ) ,
33+ ) ;
2834 }
2935
3036 if ( hasExcludeHandleFilters ( settings ) ) {
31- return ! settings . filterExcludeHandles . some ( ( handle ) =>
32- filterNotificationByHandle ( notification , handle ) ,
33- ) ;
37+ passesFilters =
38+ passesFilters &&
39+ ! settings . filterExcludeHandles . some ( ( handle ) =>
40+ filterNotificationByHandle ( notification , handle ) ,
41+ ) ;
3442 }
3543
3644 if ( hasStateFilters ( settings ) ) {
@@ -41,12 +49,14 @@ export function filterNotifications(
4149 }
4250
4351 if ( hasReasonFilters ( settings ) ) {
44- return settings . filterReasons . some ( ( reason ) =>
45- filterNotificationByReason ( notification , reason ) ,
46- ) ;
52+ passesFilters =
53+ passesFilters &&
54+ settings . filterReasons . some ( ( reason ) =>
55+ filterNotificationByReason ( notification , reason ) ,
56+ ) ;
4757 }
4858
49- return true ;
59+ return passesFilters ;
5060 } ) ;
5161}
5262
0 commit comments