feat: implement remote unfollow — wire FederationActionPort through delete_follow handler

This commit is contained in:
2026-05-15 02:46:24 +02:00
parent eebdbeaaf2
commit 031a22514d
5 changed files with 100 additions and 7 deletions

View File

@@ -79,13 +79,15 @@ pub async fn delete_follow(
AuthUser(uid): AuthUser,
Path(username): Path<String>,
) -> Result<StatusCode, ApiError> {
if username.contains('@') {
return Err(ApiError::BadRequest(
"remote unfollow not yet supported".into(),
));
}
let target = get_user_by_username(&*s.users, &username).await?;
unfollow_user(&*s.follows, &*s.events, &uid, &target.id).await?;
unfollow_actor(
&*s.follows,
&*s.users,
&*s.federation,
&*s.events,
&uid,
&username,
)
.await?;
Ok(StatusCode::NO_CONTENT)
}
#[utoipa::path(post, path = "/users/{username}/block", params(("username" = String, Path, description = "Username")), responses((status = 204, description = "Blocked")), security(("bearer_auth" = [])))]