Skip to content

Commit 3f7d327

Browse files
committed
Merge branch 'main' into feat/filter-by-state
2 parents 04a874b + da58488 commit 3f7d327

File tree

3 files changed

+29
-19
lines changed

3 files changed

+29
-19
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@
181181
"tailwind-merge": "3.0.2",
182182
"tailwindcss": "4.0.8",
183183
"terser-webpack-plugin": "5.3.11",
184-
"ts-jest": "29.2.5",
184+
"ts-jest": "29.2.6",
185185
"ts-loader": "9.5.2",
186186
"ts-node": "10.9.2",
187187
"typescript": "5.7.3",

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/renderer/utils/notifications/filters/filter.ts

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)