damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit a2eb77a5e961b4ee4ce98371bb9f3a490937e0fa
parent 29a82065868e1c72fe12b19f8d2ac8e7f345a964
Author: William Casarin <jb55@jb55.com>
Date:   Sun,  5 Feb 2023 10:49:51 -0800

Hide incoming dms from blocked users

Changelog-Fixed: Hide incoming DMs from blocked users

Diffstat:
Mdamus/Models/HomeModel.swift | 9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/damus/Models/HomeModel.swift b/damus/Models/HomeModel.swift @@ -476,7 +476,7 @@ class HomeModel: ObservableObject { } func handle_dm(_ ev: NostrEvent) { - if let notifs = handle_incoming_dm(prev_events: self.new_events, dms: self.dms, our_pubkey: self.damus_state.pubkey, ev: ev) { + if let notifs = handle_incoming_dm(contacts: damus_state.contacts, prev_events: self.new_events, dms: self.dms, our_pubkey: self.damus_state.pubkey, ev: ev) { self.new_events = notifs } } @@ -707,7 +707,12 @@ func load_our_relays(contacts: Contacts, our_pubkey: String, pool: RelayPool, m_ } } -func handle_incoming_dm(prev_events: NewEventsBits, dms: DirectMessagesModel, our_pubkey: String, ev: NostrEvent) -> NewEventsBits? { +func handle_incoming_dm(contacts: Contacts, prev_events: NewEventsBits, dms: DirectMessagesModel, our_pubkey: String, ev: NostrEvent) -> NewEventsBits? { + // hide blocked users + guard should_show_event(contacts: contacts, ev: ev) else { + return prev_events + } + var inserted = false var found = false let ours = ev.pubkey == our_pubkey