Added filters for notifications and system tray items. (#234)
* Added filters for notifications and systray. closes #233 * Add links to documentation.
This commit is contained in:
15
lib/shared/notifications.ts
Normal file
15
lib/shared/notifications.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Notification } from "types/service/notifications";
|
||||
|
||||
export const filterNotifications = (notifications: Notification[], filter: string[]): Notification[] => {
|
||||
|
||||
const notifFilter = new Set(
|
||||
filter.map((name: string) => name.toLowerCase().replace(/\s+/g, '_'))
|
||||
);
|
||||
|
||||
const filteredNotifications = notifications.filter((notif: Notification) => {
|
||||
const normalizedAppName = notif.app_name.toLowerCase().replace(/\s+/g, '_');
|
||||
return !notifFilter.has(normalizedAppName);
|
||||
});
|
||||
|
||||
return filteredNotifications;
|
||||
}
|
||||
Reference in New Issue
Block a user