feat: implement remote unfollow — wire FederationActionPort through delete_follow handler
This commit is contained in:
@@ -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" = [])))]
|
||||
|
||||
Reference in New Issue
Block a user