From 6f2aa56b9eaa7710695b0ccb87e8871e036988dd Mon Sep 17 00:00:00 2001 From: William Casarin Date: Sun, 14 Apr 2024 16:30:12 -0700 Subject: [PATCH] ids: find more unknown ids from inline notes Signed-off-by: William Casarin --- src/app.rs | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/app.rs b/src/app.rs index a0ea6b81..5c281ada 100644 --- a/src/app.rs +++ b/src/app.rs @@ -233,16 +233,31 @@ fn get_unknown_note_ids<'a>( ids.insert(UnknownId::Pubkey(nprofile.pubkey())); } } - Mention::Event(ev) => { - if ndb.get_note_by_id(txn, ev.id()).is_err() { + Mention::Event(ev) => match ndb.get_note_by_id(txn, ev.id()) { + Err(_) => { ids.insert(UnknownId::Id(ev.id())); + if let Some(pk) = ev.pubkey() { + if ndb.get_profile_by_pubkey(txn, pk).is_err() { + ids.insert(UnknownId::Pubkey(pk)); + } + } } - } - Mention::Note(note) => { - if ndb.get_note_by_id(txn, note.id()).is_err() { + Ok(note) => { + if ndb.get_profile_by_pubkey(txn, note.pubkey()).is_err() { + ids.insert(UnknownId::Pubkey(note.pubkey())); + } + } + }, + Mention::Note(note) => match ndb.get_note_by_id(txn, note.id()) { + Err(_) => { ids.insert(UnknownId::Id(note.id())); } - } + Ok(note) => { + if ndb.get_profile_by_pubkey(txn, note.pubkey()).is_err() { + ids.insert(UnknownId::Pubkey(note.pubkey())); + } + } + }, _ => {} },