fix(content): handle case where notes are not loaded

This commit is contained in:
Fernando López Guevara
2025-06-09 10:51:17 -03:00
committed by William Casarin
parent 48f17f91b8
commit c6dbb0e856
9 changed files with 24 additions and 23 deletions

View File

@@ -5,6 +5,7 @@ pub use action::{MediaAction, NoteAction, ZapAction, ZapTargetAmount};
pub use context::{BroadcastContext, ContextSelection, NoteContextSelection};
use crate::JobPool;
use crate::UnknownIds;
use crate::{notecache::NoteCache, zaps::Zaps, Images};
use enostr::{NoteId, RelayPool};
use nostrdb::{Ndb, Note, NoteKey, QueryResult, Transaction};
@@ -21,6 +22,7 @@ pub struct NoteContext<'d> {
pub zaps: &'d mut Zaps,
pub pool: &'d mut RelayPool,
pub job_pool: &'d mut JobPool,
pub unknown_ids: &'d mut UnknownIds,
pub current_account_has_wallet: bool,
}

View File

@@ -201,7 +201,11 @@ impl UnknownIds {
return;
}
self.ids.entry(UnknownId::Pubkey(*pubkey)).or_default();
let unknown_id = UnknownId::Pubkey(*pubkey);
if self.ids.contains_key(&unknown_id) {
return;
}
self.ids.entry(unknown_id).or_default();
self.mark_updated();
}
@@ -211,9 +215,11 @@ impl UnknownIds {
return;
}
self.ids
.entry(UnknownId::Id(NoteId::new(*note_id)))
.or_default();
let unknown_id = UnknownId::Id(NoteId::new(*note_id));
if self.ids.contains_key(&unknown_id) {
return;
}
self.ids.entry(unknown_id).or_default();
self.mark_updated();
}
}