damus

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

commit 8e7c7e1cd5e87b25c5015ef2b8c366f0edb567bf
parent 4d68621530df1776187f85e031b2558ac9da84c3
Author: William Casarin <jb55@jb55.com>
Date:   Sat, 18 Jun 2022 12:39:48 -0700

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>

Diffstat:
Mdamus/Models/SearchHomeModel.swift | 5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git a/damus/Models/SearchHomeModel.swift b/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 }