Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions src-tauri/src/nostr/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,13 @@ pub async fn unfollow(id: &str, state: State<'_, Nostr>) -> Result<String, Strin
let contact_list = client.get_contact_list(Some(Duration::from_secs(10))).await;

match contact_list {
Ok(mut old_list) => {
let index = old_list
.iter()
.position(|x| x.public_key == public_key)
.unwrap();
old_list.remove(index);

let new_list = old_list.into_iter();
Ok(old_list) => {
let contacts: Vec<Contact> = old_list
.into_iter()
.filter(|contact| contact.public_key != public_key)
.collect();

match client.set_contact_list(new_list).await {
match client.set_contact_list(contacts).await {
Ok(event_id) => Ok(event_id.to_string()),
Err(err) => Err(err.to_string()),
}
Expand Down