commit 682704b2cbc0388541160b396a6be31c0d997283
parent 176f1a338a59802e4673b609850c444807ebd58d
Author: Daniel D’Aquino <daniel@daquino.me>
Date: Wed, 6 Aug 2025 13:48:49 -0700
Fix quoted note regression
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 <daniel@daquino.me>
Diffstat:
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git 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<NoteId>? {
- 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<NoteId>.note(noteId, index: index))
+ case .nevent(let nEvent):
+ return .loopReturn(Mention<NoteId>.note(nEvent.noteid, index: index))
default:
- return .loopBreak
+ return .loopContinue
}
default:
return .loopContinue