Browse Source

fix is_friend_reply

Signed-off-by: William Casarin <jb55@jb55.com>
profiles-everywhere
William Casarin 3 years ago
parent
commit
b230d430ee
  1. 19
      damus/Models/Contacts.swift

19
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

Loading…
Cancel
Save