fix premature use of

This commit is contained in:
glyph 2022-10-02 17:31:44 +01:00
parent 6f1536a09d
commit 504ca08076
1 changed files with 10 additions and 10 deletions

View File

@ -220,33 +220,33 @@ At this point we have the capability to check whether we follow a peer, to add a
```rust ```rust
// Update this match block in `subscribe_form` // Update this match block in `subscribe_form`
match sbot::is_following(&whoami, remote_peer).await { match sbot::is_following(&whoami, &peer.public_key).await {
Ok(status) if status.as_str() == "false" => { Ok(status) if status.as_str() == "false" => {
// If we are not following the peer, call the `follow_peer` method. // If we are not following the peer, call the `follow_peer` method.
match sbot::follow_peer(remote_peer).await { match sbot::follow_peer(&peer.public_key).await {
Ok(_) => info!("Followed peer {}", &remote_peer), Ok(_) => info!("Followed peer {}", &peer.public_key),
Err(e) => warn!("Failed to follow peer {}: {}", &remote_peer, e), Err(e) => warn!("Failed to follow peer {}: {}", &peer.public_key, e),
} }
} }
Ok(status) if status.as_str() == "true" => { Ok(status) if status.as_str() == "true" => {
info!( info!(
"Already following peer {}. No further action taken", "Already following peer {}. No further action taken",
&remote_peer &peer.public_key
) )
} }
_ => (), _ => (),
} }
// Update this match block in `unsubscribe_form` // Update this match block in `unsubscribe_form`
match sbot::is_following(&whoami, remote_peer).await { match sbot::is_following(&whoami, &peer.public_key).await {
Ok(status) if status.as_str() == "true" => { Ok(status) if status.as_str() == "true" => {
// If we are following the peer, call the `unfollow_peer` method. // If we are following the peer, call the `unfollow_peer` method.
info!("Unfollowing peer {}", &remote_peer); info!("Unfollowing peer {}", &peer.public_key);
match sbot::unfollow_peer(remote_peer).await { match sbot::unfollow_peer(&peer.public_key).await {
Ok(_) => { Ok(_) => {
info!("Unfollowed peer {}", &remote_peer); info!("Unfollowed peer {}", &peer.public_key);
} }
Err(e) => warn!("Failed to unfollow peer {}: {}", &remote_peer, e), Err(e) => warn!("Failed to unfollow peer {}: {}", &peer.public_key, e),
} }
} }
_ => (), _ => (),