Mute events in threads

Changlog-Added: Mute events in threads
This commit is contained in:
William Casarin
2023-01-27 10:18:28 -08:00
parent d559dd3a13
commit 5edb7df5c4
8 changed files with 152 additions and 38 deletions

View File

@@ -410,15 +410,8 @@ class HomeModel: ObservableObject {
return ok
}
func should_hide_event(_ ev: NostrEvent) -> Bool {
if damus_state.contacts.is_muted(ev.pubkey) {
return true
}
return !ev.should_show_event
}
func handle_text_event(sub_id: String, _ ev: NostrEvent) {
if should_hide_event(ev) {
if should_hide_event(contacts: damus_state.contacts, ev: ev) {
return
}
@@ -726,3 +719,11 @@ func event_has_our_pubkey(_ ev: NostrEvent, our_pubkey: String) -> Bool {
return false
}
func should_hide_event(contacts: Contacts, ev: NostrEvent) -> Bool {
if contacts.is_muted(ev.pubkey) {
return true
}
return !ev.should_show_event
}