nip10: simplify and fix reply-to-root bugs

This removes EventRefs alltogether and uses the form we use in Damus
Android.

This simplifies our ThreadReply logic and fixes a reply-to-root bug

Reported-by: NotBiebs <justinbieber@stemstr.app>
Changelog-Fixed: Fix thread bug where a quote isn't picked up as a reply
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2024-05-11 09:02:09 -07:00
parent 8dbdff7ff0
commit 52aefc8d64
17 changed files with 139 additions and 499 deletions

View File

@@ -16,7 +16,7 @@ enum FilterState : Int {
func filter(ev: NostrEvent) -> Bool {
switch self {
case .posts:
return ev.known_kind == .boost || !ev.is_reply(.empty)
return ev.known_kind == .boost || !ev.is_reply()
case .posts_and_replies:
return true
}

View File

@@ -60,7 +60,7 @@ class SearchHomeModel: ObservableObject {
guard sub_id == self.base_subid || sub_id == self.profiles_subid else {
return
}
if ev.is_textlike && should_show_event(state: damus_state, ev: ev) && !ev.is_reply(damus_state.keypair)
if ev.is_textlike && should_show_event(state: damus_state, ev: ev) && !ev.is_reply()
{
if !damus_state.settings.multiple_events_per_pubkey && seen_pubkey.contains(ev.pubkey) {
return

View File

@@ -60,7 +60,7 @@ class ThreadModel: ObservableObject {
var event_filter = NostrFilter()
var ref_events = NostrFilter()
let thread_id = event.thread_id(keypair: .empty)
let thread_id = event.thread_id()
ref_events.referenced_ids = [thread_id, event.id]
ref_events.kinds = [.text]