Skip muted content

This commit is contained in:
Ken Sedgwick
2024-11-19 12:59:53 -08:00
parent d595631966
commit 84838478b3
14 changed files with 134 additions and 37 deletions

View File

@@ -374,6 +374,7 @@ pub fn render_add_column_routes(
&mut app.pool,
&mut app.note_cache,
app.since_optimize,
&app.accounts.mutefun(),
);
app.columns_mut().add_timeline_to_column(col, timeline);
}

View File

@@ -9,7 +9,7 @@ pub use picture::ProfilePic;
pub use preview::ProfilePreview;
use crate::{
actionbar::NoteAction, imgcache::ImageCache, notecache::NoteCache,
actionbar::NoteAction, imgcache::ImageCache, muted::MuteFun, notecache::NoteCache,
notes_holder::NotesHolderStorage, profile::Profile,
};
@@ -46,7 +46,7 @@ impl<'a> ProfileView<'a> {
}
}
pub fn ui(&mut self, ui: &mut egui::Ui) -> Option<NoteAction> {
pub fn ui(&mut self, ui: &mut egui::Ui, is_muted: &MuteFun) -> Option<NoteAction> {
let scroll_id = egui::Id::new(("profile_scroll", self.col_id, self.pubkey));
ScrollArea::vertical()
@@ -58,7 +58,13 @@ impl<'a> ProfileView<'a> {
}
let profile = self
.profiles
.notes_holder_mutated(self.ndb, self.note_cache, &txn, self.pubkey.bytes())
.notes_holder_mutated(
self.ndb,
self.note_cache,
&txn,
self.pubkey.bytes(),
is_muted,
)
.get_ptr();
profile.timeline.selected_view = tabs_ui(ui);

View File

@@ -1,6 +1,7 @@
use crate::{
actionbar::NoteAction,
imgcache::ImageCache,
muted::MuteFun,
notecache::NoteCache,
notes_holder::{NotesHolder, NotesHolderStorage},
thread::Thread,
@@ -52,7 +53,7 @@ impl<'a> ThreadView<'a> {
self
}
pub fn ui(&mut self, ui: &mut egui::Ui) -> Option<NoteAction> {
pub fn ui(&mut self, ui: &mut egui::Ui, is_muted: &MuteFun) -> Option<NoteAction> {
let txn = Transaction::new(self.ndb).expect("txn");
let selected_note_key = if let Ok(key) = self
@@ -97,13 +98,13 @@ impl<'a> ThreadView<'a> {
let thread = self
.threads
.notes_holder_mutated(self.ndb, self.note_cache, &txn, root_id)
.notes_holder_mutated(self.ndb, self.note_cache, &txn, root_id, is_muted)
.get_ptr();
// TODO(jb55): skip poll if ThreadResult is fresh?
// poll for new notes and insert them into our existing notes
match thread.poll_notes_into_view(&txn, self.ndb) {
match thread.poll_notes_into_view(&txn, self.ndb, is_muted) {
Ok(action) => {
action.process_action(&txn, self.ndb, self.unknown_ids, self.note_cache)
}