refactor(application): move local/remote follow routing out of presentation handler

This commit is contained in:
2026-05-15 01:58:40 +02:00
parent 344bcf34af
commit 9757ebdabf
2 changed files with 66 additions and 8 deletions

View File

@@ -57,12 +57,15 @@ pub async fn post_follow(
AuthUser(uid): AuthUser,
Path(username): Path<String>,
) -> Result<StatusCode, ApiError> {
if username.contains('@') {
s.federation.follow_remote(&uid, &username).await?;
} else {
let target = get_user_by_username(&*s.users, &username).await?;
follow_user(&*s.follows, &*s.events, &uid, &target.id).await?;
}
follow_actor(
&*s.follows,
&*s.users,
&*s.federation,
&*s.events,
&uid,
&username,
)
.await?;
Ok(StatusCode::NO_CONTENT)
}
#[utoipa::path(