damus

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

commit b230d430ee7776e54285bf8dfe5dab0e8810718b
parent e50c8f0dbc1fd13cf525960ede18c4fad3f10714
Author: William Casarin <jb55@jb55.com>
Date:   Sat, 21 May 2022 21:32:52 -0700

fix is_friend_reply

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mdamus/Models/Contacts.swift | 19+++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/damus/Models/Contacts.swift b/damus/Models/Contacts.swift @@ -120,27 +120,22 @@ func make_contact_relays(_ relays: [RelayDescriptor]) -> [String: RelayInfo] { } } - +// TODO: tests for this func is_friend_event(_ ev: NostrEvent, our_pubkey: String, friends: Set<String>) -> Bool { - if ev.pubkey == our_pubkey { - return true + if !friends.contains(ev.pubkey) { + return false } - if friends.contains(ev.pubkey) { + if !ev.is_reply { return true } - if ev.is_reply { - // show our replies? - if ev.pubkey == our_pubkey { + // show our replies? + for pk in ev.referenced_pubkeys { + if friends.contains(pk.ref_id) { return true } - for pk in ev.referenced_pubkeys { - if friends.contains(pk.ref_id) { - return true - } - } } return false