From 1339ec3ded7e3f85a3471737cd15879255c7bf9e Mon Sep 17 00:00:00 2001 From: William Casarin Date: Sat, 16 Mar 2024 12:15:48 +0000 Subject: [PATCH] note: add is_quote_repost helper This will be used for excluding quote repost notes from threads Signed-off-by: William Casarin --- nostrdb/NdbNote.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nostrdb/NdbNote.swift b/nostrdb/NdbNote.swift index ba543a71..4ce5e726 100644 --- a/nostrdb/NdbNote.swift +++ b/nostrdb/NdbNote.swift @@ -280,6 +280,13 @@ extension NdbNote { return kind == 1 || kind == 42 || kind == 30023 } + var is_quote_repost: NoteId? { + guard kind == 1, let quoted_note_id = referenced_quote_ids.first else { + return nil + } + return quoted_note_id.note_id + } + var known_kind: NostrKind? { return NostrKind.init(rawValue: kind) }