notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit 6f2aa56b9eaa7710695b0ccb87e8871e036988dd
parent 402a1337f2b9db2414a61f22e84b4a8c3df8fc4e
Author: William Casarin <jb55@jb55.com>
Date:   Sun, 14 Apr 2024 16:30:12 -0700

ids: find more unknown ids from inline notes

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Msrc/app.rs | 27+++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)

diff --git 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())); + } + } + }, _ => {} },