remove MuteFun prop

Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
kernelkind
2025-07-14 21:00:06 -04:00
parent 397bfce817
commit a7f5319fde
6 changed files with 15 additions and 52 deletions

View File

@@ -598,7 +598,6 @@ fn render_nav_body(
SearchView::new( SearchView::new(
&txn, &txn,
&ctx.accounts.mutefun(),
app.note_options, app.note_options,
search_buffer, search_buffer,
&mut note_context, &mut note_context,

View File

@@ -6,7 +6,7 @@ use crate::{
}; };
use enostr::Pubkey; use enostr::Pubkey;
use notedeck::{MuteFun, NoteContext}; use notedeck::NoteContext;
use notedeck_ui::{jobs::JobsCache, NoteOptions}; use notedeck_ui::{jobs::JobsCache, NoteOptions};
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
@@ -28,15 +28,9 @@ pub fn render_timeline_route(
| TimelineKind::Universe | TimelineKind::Universe
| TimelineKind::Hashtag(_) | TimelineKind::Hashtag(_)
| TimelineKind::Generic(_) => { | TimelineKind::Generic(_) => {
let note_action = ui::TimelineView::new( let note_action =
kind, ui::TimelineView::new(kind, timeline_cache, note_context, note_options, jobs)
timeline_cache, .ui(ui);
&note_context.accounts.mutefun(),
note_context,
note_options,
jobs,
)
.ui(ui);
note_action.map(RenderNavAction::NoteAction) note_action.map(RenderNavAction::NoteAction)
} }
@@ -48,22 +42,15 @@ pub fn render_timeline_route(
timeline_cache, timeline_cache,
col, col,
ui, ui,
&note_context.accounts.mutefun(),
note_options, note_options,
note_context, note_context,
jobs, jobs,
) )
} else { } else {
// we render profiles like timelines if they are at the root // we render profiles like timelines if they are at the root
let note_action = ui::TimelineView::new( let note_action =
kind, ui::TimelineView::new(kind, timeline_cache, note_context, note_options, jobs)
timeline_cache, .ui(ui);
&note_context.accounts.mutefun(),
note_context,
note_options,
jobs,
)
.ui(ui);
note_action.map(RenderNavAction::NoteAction) note_action.map(RenderNavAction::NoteAction)
} }
@@ -89,7 +76,6 @@ pub fn render_thread_route(
threads, threads,
selection.selected_or_root(), selection.selected_or_root(),
note_options, note_options,
&note_context.accounts.mutefun(),
note_context, note_context,
jobs, jobs,
) )
@@ -104,7 +90,6 @@ pub fn render_profile_route(
timeline_cache: &mut TimelineCache, timeline_cache: &mut TimelineCache,
col: usize, col: usize,
ui: &mut egui::Ui, ui: &mut egui::Ui,
is_muted: &MuteFun,
note_options: NoteOptions, note_options: NoteOptions,
note_context: &mut NoteContext, note_context: &mut NoteContext,
jobs: &mut JobsCache, jobs: &mut JobsCache,
@@ -114,7 +99,6 @@ pub fn render_profile_route(
col, col,
timeline_cache, timeline_cache,
note_options, note_options,
is_muted,
note_context, note_context,
jobs, jobs,
) )

View File

@@ -12,8 +12,8 @@ use crate::{
ui::timeline::{tabs_ui, TimelineTabView}, ui::timeline::{tabs_ui, TimelineTabView},
}; };
use notedeck::{ use notedeck::{
name::get_display_name, profile::get_profile_url, IsFollowing, MuteFun, NoteAction, name::get_display_name, profile::get_profile_url, IsFollowing, NoteAction, NoteContext,
NoteContext, NotedeckTextStyle, NotedeckTextStyle,
}; };
use notedeck_ui::{ use notedeck_ui::{
app_images, app_images,
@@ -27,7 +27,6 @@ pub struct ProfileView<'a, 'd> {
col_id: usize, col_id: usize,
timeline_cache: &'a mut TimelineCache, timeline_cache: &'a mut TimelineCache,
note_options: NoteOptions, note_options: NoteOptions,
is_muted: &'a MuteFun,
note_context: &'a mut NoteContext<'d>, note_context: &'a mut NoteContext<'d>,
jobs: &'a mut JobsCache, jobs: &'a mut JobsCache,
} }
@@ -46,7 +45,6 @@ impl<'a, 'd> ProfileView<'a, 'd> {
col_id: usize, col_id: usize,
timeline_cache: &'a mut TimelineCache, timeline_cache: &'a mut TimelineCache,
note_options: NoteOptions, note_options: NoteOptions,
is_muted: &'a MuteFun,
note_context: &'a mut NoteContext<'d>, note_context: &'a mut NoteContext<'d>,
jobs: &'a mut JobsCache, jobs: &'a mut JobsCache,
) -> Self { ) -> Self {
@@ -55,7 +53,6 @@ impl<'a, 'd> ProfileView<'a, 'd> {
col_id, col_id,
timeline_cache, timeline_cache,
note_options, note_options,
is_muted,
note_context, note_context,
jobs, jobs,
} }
@@ -113,7 +110,6 @@ impl<'a, 'd> ProfileView<'a, 'd> {
reversed, reversed,
self.note_options, self.note_options,
&txn, &txn,
self.is_muted,
self.note_context, self.note_context,
self.jobs, self.jobs,
) )

View File

@@ -5,7 +5,7 @@ use state::TypingType;
use crate::{timeline::TimelineTab, ui::timeline::TimelineTabView}; use crate::{timeline::TimelineTab, ui::timeline::TimelineTabView};
use egui_winit::clipboard::Clipboard; use egui_winit::clipboard::Clipboard;
use nostrdb::{Filter, Ndb, Transaction}; use nostrdb::{Filter, Ndb, Transaction};
use notedeck::{MuteFun, NoteAction, NoteContext, NoteRef}; use notedeck::{NoteAction, NoteContext, NoteRef};
use notedeck_ui::{ use notedeck_ui::{
context_menu::{input_context, PasteBehavior}, context_menu::{input_context, PasteBehavior},
icons::search_icon, icons::search_icon,
@@ -25,7 +25,6 @@ pub struct SearchView<'a, 'd> {
query: &'a mut SearchQueryState, query: &'a mut SearchQueryState,
note_options: NoteOptions, note_options: NoteOptions,
txn: &'a Transaction, txn: &'a Transaction,
is_muted: &'a MuteFun,
note_context: &'a mut NoteContext<'d>, note_context: &'a mut NoteContext<'d>,
jobs: &'a mut JobsCache, jobs: &'a mut JobsCache,
} }
@@ -33,7 +32,6 @@ pub struct SearchView<'a, 'd> {
impl<'a, 'd> SearchView<'a, 'd> { impl<'a, 'd> SearchView<'a, 'd> {
pub fn new( pub fn new(
txn: &'a Transaction, txn: &'a Transaction,
is_muted: &'a MuteFun,
note_options: NoteOptions, note_options: NoteOptions,
query: &'a mut SearchQueryState, query: &'a mut SearchQueryState,
note_context: &'a mut NoteContext<'d>, note_context: &'a mut NoteContext<'d>,
@@ -41,7 +39,6 @@ impl<'a, 'd> SearchView<'a, 'd> {
) -> Self { ) -> Self {
Self { Self {
txn, txn,
is_muted,
query, query,
note_options, note_options,
note_context, note_context,
@@ -152,7 +149,6 @@ impl<'a, 'd> SearchView<'a, 'd> {
reversed, reversed,
self.note_options, self.note_options,
self.txn, self.txn,
self.is_muted,
self.note_context, self.note_context,
self.jobs, self.jobs,
) )

View File

@@ -2,7 +2,7 @@ use egui::InnerResponse;
use egui_virtual_list::VirtualList; use egui_virtual_list::VirtualList;
use nostrdb::{Note, Transaction}; use nostrdb::{Note, Transaction};
use notedeck::note::root_note_id_from_selected_id; use notedeck::note::root_note_id_from_selected_id;
use notedeck::{MuteFun, NoteAction, NoteContext}; use notedeck::{NoteAction, NoteContext};
use notedeck_ui::jobs::JobsCache; use notedeck_ui::jobs::JobsCache;
use notedeck_ui::note::NoteResponse; use notedeck_ui::note::NoteResponse;
use notedeck_ui::{NoteOptions, NoteView}; use notedeck_ui::{NoteOptions, NoteView};
@@ -15,7 +15,6 @@ pub struct ThreadView<'a, 'd> {
note_options: NoteOptions, note_options: NoteOptions,
col: usize, col: usize,
id_source: egui::Id, id_source: egui::Id,
is_muted: &'a MuteFun,
note_context: &'a mut NoteContext<'d>, note_context: &'a mut NoteContext<'d>,
jobs: &'a mut JobsCache, jobs: &'a mut JobsCache,
} }
@@ -26,7 +25,6 @@ impl<'a, 'd> ThreadView<'a, 'd> {
threads: &'a mut Threads, threads: &'a mut Threads,
selected_note_id: &'a [u8; 32], selected_note_id: &'a [u8; 32],
note_options: NoteOptions, note_options: NoteOptions,
is_muted: &'a MuteFun,
note_context: &'a mut NoteContext<'d>, note_context: &'a mut NoteContext<'d>,
jobs: &'a mut JobsCache, jobs: &'a mut JobsCache,
) -> Self { ) -> Self {
@@ -36,7 +34,6 @@ impl<'a, 'd> ThreadView<'a, 'd> {
selected_note_id, selected_note_id,
note_options, note_options,
id_source, id_source,
is_muted,
note_context, note_context,
jobs, jobs,
col: 0, col: 0,
@@ -138,7 +135,6 @@ impl<'a, 'd> ThreadView<'a, 'd> {
self.note_options, self.note_options,
self.jobs, self.jobs,
txn, txn,
self.is_muted,
) )
} }
} }
@@ -152,7 +148,6 @@ fn show_notes(
flags: NoteOptions, flags: NoteOptions,
jobs: &mut JobsCache, jobs: &mut JobsCache,
txn: &Transaction, txn: &Transaction,
is_muted: &MuteFun,
) -> Option<NoteAction> { ) -> Option<NoteAction> {
let mut action = None; let mut action = None;
@@ -162,6 +157,8 @@ fn show_notes(
let selected_note_index = thread_notes.selected_index; let selected_note_index = thread_notes.selected_index;
let notes = &thread_notes.notes; let notes = &thread_notes.notes;
let is_muted = note_context.accounts.mutefun();
list.ui_custom_layout(ui, notes.len(), |ui, cur_index| { list.ui_custom_layout(ui, notes.len(), |ui, cur_index| {
let note = &notes[cur_index]; let note = &notes[cur_index];

View File

@@ -8,7 +8,7 @@ use std::f32::consts::PI;
use tracing::{error, warn}; use tracing::{error, warn};
use crate::timeline::{TimelineCache, TimelineKind, TimelineTab, ViewFilter}; use crate::timeline::{TimelineCache, TimelineKind, TimelineTab, ViewFilter};
use notedeck::{note::root_note_id_from_selected_id, MuteFun, NoteAction, NoteContext, ScrollInfo}; use notedeck::{note::root_note_id_from_selected_id, NoteAction, NoteContext, ScrollInfo};
use notedeck_ui::{ use notedeck_ui::{
anim::{AnimationHelper, ICON_EXPANSION_MULTIPLE}, anim::{AnimationHelper, ICON_EXPANSION_MULTIPLE},
show_pointer, NoteOptions, NoteView, show_pointer, NoteOptions, NoteView,
@@ -19,7 +19,6 @@ pub struct TimelineView<'a, 'd> {
timeline_cache: &'a mut TimelineCache, timeline_cache: &'a mut TimelineCache,
note_options: NoteOptions, note_options: NoteOptions,
reverse: bool, reverse: bool,
is_muted: &'a MuteFun,
note_context: &'a mut NoteContext<'d>, note_context: &'a mut NoteContext<'d>,
jobs: &'a mut JobsCache, jobs: &'a mut JobsCache,
} }
@@ -29,7 +28,6 @@ impl<'a, 'd> TimelineView<'a, 'd> {
pub fn new( pub fn new(
timeline_id: &'a TimelineKind, timeline_id: &'a TimelineKind,
timeline_cache: &'a mut TimelineCache, timeline_cache: &'a mut TimelineCache,
is_muted: &'a MuteFun,
note_context: &'a mut NoteContext<'d>, note_context: &'a mut NoteContext<'d>,
note_options: NoteOptions, note_options: NoteOptions,
jobs: &'a mut JobsCache, jobs: &'a mut JobsCache,
@@ -40,7 +38,6 @@ impl<'a, 'd> TimelineView<'a, 'd> {
timeline_cache, timeline_cache,
note_options, note_options,
reverse, reverse,
is_muted,
note_context, note_context,
jobs, jobs,
} }
@@ -53,7 +50,6 @@ impl<'a, 'd> TimelineView<'a, 'd> {
self.timeline_cache, self.timeline_cache,
self.reverse, self.reverse,
self.note_options, self.note_options,
self.is_muted,
self.note_context, self.note_context,
self.jobs, self.jobs,
) )
@@ -72,7 +68,6 @@ fn timeline_ui(
timeline_cache: &mut TimelineCache, timeline_cache: &mut TimelineCache,
reversed: bool, reversed: bool,
note_options: NoteOptions, note_options: NoteOptions,
is_muted: &MuteFun,
note_context: &mut NoteContext, note_context: &mut NoteContext,
jobs: &mut JobsCache, jobs: &mut JobsCache,
) -> Option<NoteAction> { ) -> Option<NoteAction> {
@@ -161,7 +156,6 @@ fn timeline_ui(
reversed, reversed,
note_options, note_options,
&txn, &txn,
is_muted,
note_context, note_context,
jobs, jobs,
) )
@@ -345,7 +339,6 @@ pub struct TimelineTabView<'a, 'd> {
reversed: bool, reversed: bool,
note_options: NoteOptions, note_options: NoteOptions,
txn: &'a Transaction, txn: &'a Transaction,
is_muted: &'a MuteFun,
note_context: &'a mut NoteContext<'d>, note_context: &'a mut NoteContext<'d>,
jobs: &'a mut JobsCache, jobs: &'a mut JobsCache,
} }
@@ -357,7 +350,6 @@ impl<'a, 'd> TimelineTabView<'a, 'd> {
reversed: bool, reversed: bool,
note_options: NoteOptions, note_options: NoteOptions,
txn: &'a Transaction, txn: &'a Transaction,
is_muted: &'a MuteFun,
note_context: &'a mut NoteContext<'d>, note_context: &'a mut NoteContext<'d>,
jobs: &'a mut JobsCache, jobs: &'a mut JobsCache,
) -> Self { ) -> Self {
@@ -366,7 +358,6 @@ impl<'a, 'd> TimelineTabView<'a, 'd> {
reversed, reversed,
note_options, note_options,
txn, txn,
is_muted,
note_context, note_context,
jobs, jobs,
} }
@@ -376,7 +367,7 @@ impl<'a, 'd> TimelineTabView<'a, 'd> {
let mut action: Option<NoteAction> = None; let mut action: Option<NoteAction> = None;
let len = self.tab.notes.len(); let len = self.tab.notes.len();
let is_muted = self.is_muted; let is_muted = self.note_context.accounts.mutefun();
self.tab self.tab
.list .list