thread: ensure thread unknowns are handled
This commit is contained in:
@@ -75,6 +75,7 @@ pub fn render_nav(col: usize, app: &mut Damus, ui: &mut egui::Ui) -> Option<Rend
|
|||||||
&mut app.pool,
|
&mut app.pool,
|
||||||
&mut app.drafts,
|
&mut app.drafts,
|
||||||
&mut app.img_cache,
|
&mut app.img_cache,
|
||||||
|
&mut app.unknown_ids,
|
||||||
&mut app.note_cache,
|
&mut app.note_cache,
|
||||||
&mut app.threads,
|
&mut app.threads,
|
||||||
&mut app.accounts,
|
&mut app.accounts,
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ pub trait NotesHolder {
|
|||||||
notes: Vec<NoteRef>,
|
notes: Vec<NoteRef>,
|
||||||
) -> Self;
|
) -> Self;
|
||||||
|
|
||||||
|
#[must_use = "process_action must be handled in the Ok(action) case"]
|
||||||
fn poll_notes_into_view(
|
fn poll_notes_into_view(
|
||||||
&mut self,
|
&mut self,
|
||||||
txn: &Transaction,
|
txn: &Transaction,
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ use crate::{
|
|||||||
},
|
},
|
||||||
profile::ProfileView,
|
profile::ProfileView,
|
||||||
},
|
},
|
||||||
|
unknowns::UnknownIds,
|
||||||
};
|
};
|
||||||
|
|
||||||
use enostr::{NoteId, Pubkey, RelayPool};
|
use enostr::{NoteId, Pubkey, RelayPool};
|
||||||
@@ -47,6 +48,7 @@ pub fn render_timeline_route(
|
|||||||
pool: &mut RelayPool,
|
pool: &mut RelayPool,
|
||||||
drafts: &mut Drafts,
|
drafts: &mut Drafts,
|
||||||
img_cache: &mut ImageCache,
|
img_cache: &mut ImageCache,
|
||||||
|
unknown_ids: &mut UnknownIds,
|
||||||
note_cache: &mut NoteCache,
|
note_cache: &mut NoteCache,
|
||||||
threads: &mut NotesHolderStorage<Thread>,
|
threads: &mut NotesHolderStorage<Thread>,
|
||||||
accounts: &mut AccountManager,
|
accounts: &mut AccountManager,
|
||||||
@@ -93,10 +95,17 @@ pub fn render_timeline_route(
|
|||||||
}
|
}
|
||||||
|
|
||||||
TimelineRoute::Thread(id) => {
|
TimelineRoute::Thread(id) => {
|
||||||
let timeline_response =
|
let timeline_response = ui::ThreadView::new(
|
||||||
ui::ThreadView::new(threads, ndb, note_cache, img_cache, id.bytes(), textmode)
|
threads,
|
||||||
.id_source(egui::Id::new(("threadscroll", col)))
|
ndb,
|
||||||
.ui(ui);
|
note_cache,
|
||||||
|
unknown_ids,
|
||||||
|
img_cache,
|
||||||
|
id.bytes(),
|
||||||
|
textmode,
|
||||||
|
)
|
||||||
|
.id_source(egui::Id::new(("threadscroll", col)))
|
||||||
|
.ui(ui);
|
||||||
if let Some(bar_action) = timeline_response.bar_action {
|
if let Some(bar_action) = timeline_response.bar_action {
|
||||||
let txn = Transaction::new(ndb).expect("txn");
|
let txn = Transaction::new(ndb).expect("txn");
|
||||||
let mut cur_column = columns.columns_mut();
|
let mut cur_column = columns.columns_mut();
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ use crate::{
|
|||||||
notes_holder::{NotesHolder, NotesHolderStorage},
|
notes_holder::{NotesHolder, NotesHolderStorage},
|
||||||
thread::Thread,
|
thread::Thread,
|
||||||
ui::note::NoteOptions,
|
ui::note::NoteOptions,
|
||||||
|
unknowns::UnknownIds,
|
||||||
};
|
};
|
||||||
use nostrdb::{Ndb, NoteKey, Transaction};
|
use nostrdb::{Ndb, NoteKey, Transaction};
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
@@ -15,6 +16,7 @@ pub struct ThreadView<'a> {
|
|||||||
threads: &'a mut NotesHolderStorage<Thread>,
|
threads: &'a mut NotesHolderStorage<Thread>,
|
||||||
ndb: &'a Ndb,
|
ndb: &'a Ndb,
|
||||||
note_cache: &'a mut NoteCache,
|
note_cache: &'a mut NoteCache,
|
||||||
|
unknown_ids: &'a mut UnknownIds,
|
||||||
img_cache: &'a mut ImageCache,
|
img_cache: &'a mut ImageCache,
|
||||||
selected_note_id: &'a [u8; 32],
|
selected_note_id: &'a [u8; 32],
|
||||||
textmode: bool,
|
textmode: bool,
|
||||||
@@ -27,6 +29,7 @@ impl<'a> ThreadView<'a> {
|
|||||||
threads: &'a mut NotesHolderStorage<Thread>,
|
threads: &'a mut NotesHolderStorage<Thread>,
|
||||||
ndb: &'a Ndb,
|
ndb: &'a Ndb,
|
||||||
note_cache: &'a mut NoteCache,
|
note_cache: &'a mut NoteCache,
|
||||||
|
unknown_ids: &'a mut UnknownIds,
|
||||||
img_cache: &'a mut ImageCache,
|
img_cache: &'a mut ImageCache,
|
||||||
selected_note_id: &'a [u8; 32],
|
selected_note_id: &'a [u8; 32],
|
||||||
textmode: bool,
|
textmode: bool,
|
||||||
@@ -36,6 +39,7 @@ impl<'a> ThreadView<'a> {
|
|||||||
threads,
|
threads,
|
||||||
ndb,
|
ndb,
|
||||||
note_cache,
|
note_cache,
|
||||||
|
unknown_ids,
|
||||||
img_cache,
|
img_cache,
|
||||||
selected_note_id,
|
selected_note_id,
|
||||||
textmode,
|
textmode,
|
||||||
@@ -99,9 +103,12 @@ impl<'a> ThreadView<'a> {
|
|||||||
// TODO(jb55): skip poll if ThreadResult is fresh?
|
// TODO(jb55): skip poll if ThreadResult is fresh?
|
||||||
|
|
||||||
// poll for new notes and insert them into our existing notes
|
// poll for new notes and insert them into our existing notes
|
||||||
if let Err(e) = thread.poll_notes_into_view(&txn, self.ndb) {
|
match thread.poll_notes_into_view(&txn, self.ndb) {
|
||||||
error!("Thread::poll_notes_into_view: {e}");
|
Ok(action) => {
|
||||||
}
|
action.process_action(&txn, self.ndb, self.unknown_ids, self.note_cache)
|
||||||
|
}
|
||||||
|
Err(err) => error!("{err}"),
|
||||||
|
};
|
||||||
|
|
||||||
// This is threadview. We are not the universe view...
|
// This is threadview. We are not the universe view...
|
||||||
let is_universe = false;
|
let is_universe = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user