don't treat already-not-following as error

This commit is contained in:
glyph 2022-10-02 17:37:22 +01:00
parent 61f0883841
commit 465919792f
2 changed files with 15 additions and 0 deletions

View File

@ -323,6 +323,14 @@ pub async fn follow_if_not_following(remote_peer: &str) -> Result<(), String> {
pub async fn unfollow_if_following(remote_peer: &str) {
if let Ok(whoami) = whoami().await {
match is_following(&whoami, remote_peer).await {
Ok(status) if status.as_str() == "false" => {
info!(
"Not currently following peer {}. No further action taken",
&remote_peer
);
Ok(())
}
Ok(status) if status.as_str() == "true" => {
info!("Unfollowing peer {}", &remote_peer);
match unfollow_peer(remote_peer).await {

View File

@ -103,6 +103,13 @@ pub async fn follow_if_not_following(remote_peer: &str) -> Result<(), String> {
pub async fn unfollow_if_following(remote_peer: &str) -> Result<(), String> {
if let Ok(whoami) = whoami().await {
match is_following(&whoami, remote_peer).await {
Ok(status) if status.as_str() == "false" => {
info!(
"Not currently following peer {}. No further action taken",
&remote_peer
);
Ok(())
}
Ok(status) if status.as_str() == "true" => {
info!("Unfollowing peer {}", &remote_peer);
match unfollow_peer(remote_peer).await {