Removes notifications from muted npubs

This commit is contained in:
alltheseas
2025-10-15 00:03:20 -05:00
parent f2870b9a38
commit 6605c5e583

View File

@@ -33,7 +33,7 @@ class NotificationFilter: ObservableObject, Equatable {
self.hellthread_notification_max_pubkeys = hellthread_notification_max_pubkeys
}
func filter(contacts: Contacts, items: [NotificationItem]) -> [NotificationItem] {
func filter(contacts: Contacts, mutelist_manager: MutelistManager, items: [NotificationItem]) -> [NotificationItem] {
return items.reduce(into: []) { acc, item in
if !self.state.filter(item) {
@@ -41,6 +41,7 @@ class NotificationFilter: ObservableObject, Equatable {
}
if let item = item.filter({ ev in
!mutelist_manager.is_event_muted(ev) &&
self.friend_filter.filter(contacts: contacts, pubkey: ev.pubkey) &&
(!hellthread_notifications_disabled || !ev.is_hellthread(max_pubkeys: hellthread_notification_max_pubkeys)) &&
// Allow notes that are created no more than 3 seconds in the future
@@ -169,7 +170,7 @@ struct NotificationsView: View {
func NotificationTab(_ filter: NotificationFilter) -> some View {
ScrollViewReader { scroller in
ScrollView {
let notifs = Array(zip(1..., filter.filter(contacts: state.contacts, items: notifications.notifications)))
let notifs = Array(zip(1..., filter.filter(contacts: state.contacts, mutelist_manager: state.mutelist_manager, items: notifications.notifications)))
if notifs.isEmpty {
EmptyTimelineView()
} else {