Ignore Undo(Follow) if relationship doesn't exist

This commit is contained in:
silverpill 2022-05-22 16:31:58 +00:00
parent 5e7d3ab434
commit 61f0c5a546

View file

@ -351,7 +351,12 @@ pub async fn receive_activity(
.ok_or(ValidationError("invalid object"))?;
let target_username = parse_actor_id(&config.instance_url(), &target_actor_id)?;
let target_profile = get_profile_by_acct(db_client, &target_username).await?;
unfollow(db_client, &source_profile.id, &target_profile.id).await?;
match unfollow(db_client, &source_profile.id, &target_profile.id).await {
Ok(_) => (),
// Ignore Undo if relationship doesn't exist
Err(DatabaseError::NotFound(_)) => return Ok(()),
Err(other_error) => return Err(other_error.into()),
};
FOLLOW
},
(UNDO, _) => {