From 0a19915773c8d3b7e7acc3b966233345d5af2d06 Mon Sep 17 00:00:00 2001 From: alemi Date: Tue, 28 May 2024 02:05:12 +0200 Subject: [PATCH] fix: address_to helper --- src/server/context.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/server/context.rs b/src/server/context.rs index f3202b46..0af77db5 100644 --- a/src/server/context.rs +++ b/src/server/context.rs @@ -216,15 +216,13 @@ impl Context { for target in targets { if target.ends_with("/followers") { let target_id = target.replace("/followers", ""); - model::relation::Entity::find() - .filter(model::relation::Column::Following.eq(target_id)) - .select_only() - .select_column(model::relation::Column::Follower) - .into_tuple::() - .all(self.db()) - .await? - .into_iter() - .for_each(|x| out.push(x)); + let mut followers = model::relation::Entity::followers(&target_id, self.db()).await?; + if followers.is_empty() { // stuff with zero addressing will never be seen again!!! TODO + followers.push(target_id); + } + for follower in followers { + out.push(follower); + } } else { out.push(target); }