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:
@@ -12,8 +12,8 @@ use crate::{
|
||||
ui::timeline::{tabs_ui, TimelineTabView},
|
||||
};
|
||||
use notedeck::{
|
||||
name::get_display_name, profile::get_profile_url, Accounts, IsFollowing, MuteFun, NoteAction,
|
||||
NoteContext, NotedeckTextStyle,
|
||||
name::get_display_name, profile::get_profile_url, IsFollowing, NoteAction, NoteContext,
|
||||
NotedeckTextStyle,
|
||||
};
|
||||
use notedeck_ui::{
|
||||
app_images,
|
||||
@@ -24,11 +24,9 @@ use notedeck_ui::{
|
||||
|
||||
pub struct ProfileView<'a, 'd> {
|
||||
pubkey: &'a Pubkey,
|
||||
accounts: &'a Accounts,
|
||||
col_id: usize,
|
||||
timeline_cache: &'a mut TimelineCache,
|
||||
note_options: NoteOptions,
|
||||
is_muted: &'a MuteFun,
|
||||
note_context: &'a mut NoteContext<'d>,
|
||||
jobs: &'a mut JobsCache,
|
||||
}
|
||||
@@ -44,21 +42,17 @@ impl<'a, 'd> ProfileView<'a, 'd> {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
pubkey: &'a Pubkey,
|
||||
accounts: &'a Accounts,
|
||||
col_id: usize,
|
||||
timeline_cache: &'a mut TimelineCache,
|
||||
note_options: NoteOptions,
|
||||
is_muted: &'a MuteFun,
|
||||
note_context: &'a mut NoteContext<'d>,
|
||||
jobs: &'a mut JobsCache,
|
||||
) -> Self {
|
||||
ProfileView {
|
||||
pubkey,
|
||||
accounts,
|
||||
col_id,
|
||||
timeline_cache,
|
||||
note_options,
|
||||
is_muted,
|
||||
note_context,
|
||||
jobs,
|
||||
}
|
||||
@@ -116,9 +110,7 @@ impl<'a, 'd> ProfileView<'a, 'd> {
|
||||
reversed,
|
||||
self.note_options,
|
||||
&txn,
|
||||
self.is_muted,
|
||||
self.note_context,
|
||||
&(&self.accounts.get_selected_account().key).into(),
|
||||
self.jobs,
|
||||
)
|
||||
.show(ui)
|
||||
@@ -179,14 +171,14 @@ impl<'a, 'd> ProfileView<'a, 'd> {
|
||||
ui.add_space(24.0);
|
||||
|
||||
let target_key = self.pubkey;
|
||||
let selected = self.accounts.get_selected_account();
|
||||
let selected = self.note_context.accounts.get_selected_account();
|
||||
|
||||
let profile_type = if selected.key.secret_key.is_none() {
|
||||
ProfileType::ReadOnly
|
||||
} else if &selected.key.pubkey == self.pubkey {
|
||||
ProfileType::MyProfile
|
||||
} else {
|
||||
ProfileType::Followable(selected.is_following(target_key))
|
||||
ProfileType::Followable(selected.is_following(target_key.bytes()))
|
||||
};
|
||||
|
||||
match profile_type {
|
||||
|
||||
Reference in New Issue
Block a user