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);
|
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 {
|
match &self.state {
|
||||||
ContactState::Unreceived => IsFollowing::Unknown,
|
ContactState::Unreceived => IsFollowing::Unknown,
|
||||||
ContactState::Received {
|
ContactState::Received {
|
||||||
contacts,
|
contacts,
|
||||||
note_key: _,
|
note_key: _,
|
||||||
} => {
|
} => {
|
||||||
if contacts.contains(other) {
|
if contacts.contains(other_pubkey) {
|
||||||
IsFollowing::Yes
|
IsFollowing::Yes
|
||||||
} else {
|
} else {
|
||||||
IsFollowing::No
|
IsFollowing::No
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use enostr::{Keypair, KeypairUnowned, Pubkey};
|
use enostr::{Keypair, KeypairUnowned};
|
||||||
use tokenator::{ParseError, TokenParser, TokenSerializable};
|
use tokenator::{ParseError, TokenParser, TokenSerializable};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
@@ -33,8 +33,8 @@ impl UserAccount {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_following(&self, pk: &Pubkey) -> IsFollowing {
|
pub fn is_following(&self, other_pubkey: &[u8; 32]) -> IsFollowing {
|
||||||
self.data.contacts.is_following(pk)
|
self.data.contacts.is_following(other_pubkey)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ impl<'a, 'd> ProfileView<'a, 'd> {
|
|||||||
} else if &selected.key.pubkey == self.pubkey {
|
} else if &selected.key.pubkey == self.pubkey {
|
||||||
ProfileType::MyProfile
|
ProfileType::MyProfile
|
||||||
} else {
|
} else {
|
||||||
ProfileType::Followable(selected.is_following(target_key))
|
ProfileType::Followable(selected.is_following(target_key.bytes()))
|
||||||
};
|
};
|
||||||
|
|
||||||
match profile_type {
|
match profile_type {
|
||||||
|
|||||||
Reference in New Issue
Block a user