Merge is_following fixes from kernel

kernelkind (4):
      add `Accounts` to `NoteContext`
      remove `MuteFun` prop
      make `Contacts::is_following` use bytes instead of `Pubkey`
      migrate to check following through `Contacts::is_following`
This commit is contained in:
William Casarin
2025-07-16 08:50:42 -07:00
16 changed files with 84 additions and 268 deletions

View File

@@ -6,13 +6,12 @@ use crate::{
};
use enostr::Pubkey;
use notedeck::{Accounts, MuteFun, NoteContext};
use notedeck::NoteContext;
use notedeck_ui::{jobs::JobsCache, NoteOptions};
#[allow(clippy::too_many_arguments)]
pub fn render_timeline_route(
timeline_cache: &mut TimelineCache,
accounts: &mut Accounts,
kind: &TimelineKind,
col: usize,
note_options: NoteOptions,
@@ -30,18 +29,10 @@ pub fn render_timeline_route(
| TimelineKind::Universe
| TimelineKind::Hashtag(_)
| TimelineKind::Generic(_) => {
let note_action = ui::TimelineView::new(
kind,
timeline_cache,
&accounts.mutefun(),
note_context,
note_options,
&(&accounts.get_selected_account().key).into(),
jobs,
col,
)
.scroll_to_top(scroll_to_top)
.ui(ui);
let note_action =
ui::TimelineView::new(kind, timeline_cache, note_context, note_options, jobs, col)
.scroll_to_top(scroll_to_top)
.ui(ui);
note_action.map(RenderNavAction::NoteAction)
}
@@ -50,11 +41,9 @@ pub fn render_timeline_route(
if depth > 1 {
render_profile_route(
pubkey,
accounts,
timeline_cache,
col,
ui,
&accounts.mutefun(),
note_options,
note_context,
jobs,
@@ -64,10 +53,8 @@ pub fn render_timeline_route(
let note_action = ui::TimelineView::new(
kind,
timeline_cache,
&accounts.mutefun(),
note_context,
note_options,
&(&accounts.get_selected_account().key).into(),
jobs,
col,
)
@@ -83,7 +70,6 @@ pub fn render_timeline_route(
#[allow(clippy::too_many_arguments)]
pub fn render_thread_route(
threads: &mut Threads,
accounts: &mut Accounts,
selection: &ThreadSelection,
col: usize,
mut note_options: NoteOptions,
@@ -99,9 +85,7 @@ pub fn render_thread_route(
threads,
selection.selected_or_root(),
note_options,
&accounts.mutefun(),
note_context,
&(&accounts.get_selected_account().key).into(),
jobs,
)
.id_source(col)
@@ -112,22 +96,18 @@ pub fn render_thread_route(
#[allow(clippy::too_many_arguments)]
pub fn render_profile_route(
pubkey: &Pubkey,
accounts: &Accounts,
timeline_cache: &mut TimelineCache,
col: usize,
ui: &mut egui::Ui,
is_muted: &MuteFun,
note_options: NoteOptions,
note_context: &mut NoteContext,
jobs: &mut JobsCache,
) -> Option<RenderNavAction> {
let profile_view = ProfileView::new(
pubkey,
accounts,
col,
timeline_cache,
note_options,
is_muted,
note_context,
jobs,
)
@@ -135,7 +115,8 @@ pub fn render_profile_route(
if let Some(action) = profile_view {
match action {
ui::profile::ProfileViewAction::EditProfile => accounts
ui::profile::ProfileViewAction::EditProfile => note_context
.accounts
.get_full(pubkey)
.map(|kp| RenderNavAction::ProfileAction(ProfileAction::Edit(kp.to_full()))),
ui::profile::ProfileViewAction::Note(note_action) => {