don't show replies to non-friends in timeline
Changelog-Fixed: Don't show replies to non-friends in timeline Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -214,9 +214,17 @@ func is_friend_event(_ ev: NostrEvent, our_pubkey: String, contacts: Contacts) -
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let pks = ev.referenced_pubkeys
|
||||||
|
|
||||||
|
// allow reply-to-self-or-friend case
|
||||||
|
if pks.count == 1 && contacts.is_friend(pks[0].ref_id) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
// show our replies?
|
// show our replies?
|
||||||
for pk in ev.referenced_pubkeys {
|
for pk in pks {
|
||||||
if contacts.is_friend(pk.ref_id) {
|
// don't count self mentions here
|
||||||
|
if pk.ref_id != ev.pubkey && contacts.is_friend(pk.ref_id) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -289,7 +289,9 @@ class HomeModel: ObservableObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if sub_id == home_subid {
|
if sub_id == home_subid {
|
||||||
let _ = insert_home_event(ev)
|
if is_friend_event(ev, our_pubkey: damus_state.pubkey, contacts: damus_state.contacts) {
|
||||||
|
let _ = insert_home_event(ev)
|
||||||
|
}
|
||||||
} else if sub_id == notifications_subid {
|
} else if sub_id == notifications_subid {
|
||||||
handle_notification(ev: ev)
|
handle_notification(ev: ev)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user