make Contacts::is_following use bytes instead of Pubkey
Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user