make Contacts::is_following use bytes instead of Pubkey

Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
kernelkind
2025-07-14 21:14:01 -04:00
parent a7f5319fde
commit 142aa879c3
3 changed files with 6 additions and 6 deletions

View File

@@ -49,14 +49,14 @@ impl Contacts {
update_state(&mut self.state, &res.note, res.note_key);
}
pub fn is_following(&self, other: &Pubkey) -> IsFollowing {
pub fn is_following(&self, other_pubkey: &[u8; 32]) -> IsFollowing {
match &self.state {
ContactState::Unreceived => IsFollowing::Unknown,
ContactState::Received {
contacts,
note_key: _,
} => {
if contacts.contains(other) {
if contacts.contains(other_pubkey) {
IsFollowing::Yes
} else {
IsFollowing::No

View File

@@ -1,4 +1,4 @@
use enostr::{Keypair, KeypairUnowned, Pubkey};
use enostr::{Keypair, KeypairUnowned};
use tokenator::{ParseError, TokenParser, TokenSerializable};
use crate::{
@@ -33,8 +33,8 @@ impl UserAccount {
self
}
pub fn is_following(&self, pk: &Pubkey) -> IsFollowing {
self.data.contacts.is_following(pk)
pub fn is_following(&self, other_pubkey: &[u8; 32]) -> IsFollowing {
self.data.contacts.is_following(other_pubkey)
}
}

View File

@@ -178,7 +178,7 @@ impl<'a, 'd> ProfileView<'a, 'd> {
} 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 {