From 682704b2cbc0388541160b396a6be31c0d997283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20D=E2=80=99Aquino?= Date: Wed, 6 Aug 2025 13:48:49 -0700 Subject: [PATCH] Fix quoted note regression MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes a regression that caused quoted notes not to appear. Changelog-None Closes: https://github.com/damus-io/damus/issues/3163 Signed-off-by: Daniel D’Aquino --- damus/Core/Nostr/NostrEvent.swift | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/damus/Core/Nostr/NostrEvent.swift b/damus/Core/Nostr/NostrEvent.swift index 8defa0ec..225cd5f8 100644 --- a/damus/Core/Nostr/NostrEvent.swift +++ b/damus/Core/Nostr/NostrEvent.swift @@ -780,23 +780,19 @@ func validate_event(ev: NostrEvent) -> ValidationResult { } func first_eref_mention(ndb: Ndb, ev: NostrEvent, keypair: Keypair) -> Mention? { - guard let blockGroup = try? NdbBlockGroup.from(event: ev, using: ndb, and: keypair) else { - return nil - } + guard let blockGroup = try? NdbBlockGroup.from(event: ev, using: ndb, and: keypair) else { return nil } - return try? blockGroup.forEachBlock({ index, block in - // Step 1: Filter + return blockGroup.forEachBlock({ index, block in switch block { case .mention(let mention): - switch mention.bech32_type { - case .note: - let data = mention.bech32.note.event_id.as_data(size: 32) - return .loopReturn(.note(NoteId(data))) - case .nevent: - let data = mention.bech32.nevent.event_id.as_data(size: 32) - return .loopReturn(.note(NoteId(data))) + guard let mention = MentionRef(block: mention) else { return .loopContinue } + switch mention.nip19 { + case .note(let noteId): + return .loopReturn(Mention.note(noteId, index: index)) + case .nevent(let nEvent): + return .loopReturn(Mention.note(nEvent.noteid, index: index)) default: - return .loopBreak + return .loopContinue } default: return .loopContinue