Browse Source

search/home: hide duplicate user posts

This cuts down on the spam a bit

Changelog-Changed: Search home now only shows users at most once to cut down on spam
Signed-off-by: William Casarin <jb55@jb55.com>
profiles-everywhere
William Casarin 3 years ago
parent
commit
8e7c7e1cd5
  1. 5
      damus/Models/SearchHomeModel.swift

5
damus/Models/SearchHomeModel.swift

@ -13,6 +13,7 @@ class SearchHomeModel: ObservableObject {
@Published var events: [NostrEvent] = []
@Published var loading: Bool = false
var seen_pubkey: Set<String> = Set()
let pool: RelayPool
let sub_id = UUID().description
let limit: UInt32 = 250
@ -49,6 +50,10 @@ class SearchHomeModel: ObservableObject {
return
}
if ev.kind == NostrKind.text.rawValue {
if seen_pubkey.contains(ev.pubkey) {
return
}
seen_pubkey.insert(ev.pubkey)
let _ = insert_uniq_sorted_event(events: &events, new_ev: ev) {
$0.created_at > $1.created_at
}

Loading…
Cancel
Save