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>
This commit is contained in:
@@ -780,23 +780,19 @@ func validate_event(ev: NostrEvent) -> ValidationResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func first_eref_mention(ndb: Ndb, ev: NostrEvent, keypair: Keypair) -> Mention<NoteId>? {
|
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 {
|
guard let blockGroup = try? NdbBlockGroup.from(event: ev, using: ndb, and: keypair) else { return nil }
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
return try? blockGroup.forEachBlock({ index, block in
|
return blockGroup.forEachBlock({ index, block in
|
||||||
// Step 1: Filter
|
|
||||||
switch block {
|
switch block {
|
||||||
case .mention(let mention):
|
case .mention(let mention):
|
||||||
switch mention.bech32_type {
|
guard let mention = MentionRef(block: mention) else { return .loopContinue }
|
||||||
case .note:
|
switch mention.nip19 {
|
||||||
let data = mention.bech32.note.event_id.as_data(size: 32)
|
case .note(let noteId):
|
||||||
return .loopReturn(.note(NoteId(data)))
|
return .loopReturn(Mention<NoteId>.note(noteId, index: index))
|
||||||
case .nevent:
|
case .nevent(let nEvent):
|
||||||
let data = mention.bech32.nevent.event_id.as_data(size: 32)
|
return .loopReturn(Mention<NoteId>.note(nEvent.noteid, index: index))
|
||||||
return .loopReturn(.note(NoteId(data)))
|
|
||||||
default:
|
default:
|
||||||
return .loopBreak
|
return .loopContinue
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return .loopContinue
|
return .loopContinue
|
||||||
|
|||||||
Reference in New Issue
Block a user