From e6e13e95da1695ecf824f36e32bbf101f1cd7498 Mon Sep 17 00:00:00 2001 From: alemi Date: Sat, 22 Jun 2024 05:41:37 +0200 Subject: [PATCH] docs: added notes on improving addressing expansion --- upub/core/src/traits/address.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/upub/core/src/traits/address.rs b/upub/core/src/traits/address.rs index 29b27b6..fca62f1 100644 --- a/upub/core/src/traits/address.rs +++ b/upub/core/src/traits/address.rs @@ -114,6 +114,16 @@ async fn address_to(ctx: &crate::Context, to: Vec, aid: Option, oid async fn expand_addressing(targets: Vec, tx: &impl ConnectionTrait) -> Result, DbErr> { let mut out = Vec::new(); for target in targets { + // TODO this is definitely NOT a reliable way to expand followers collections... + // we should add an index on following field in users and try to search for that: no + // guarantee that all followers collections end with 'followers'! once we get the actual + // user we can resolve their followers with the relations table + // ! NOTE THAT local users have followers set to NULL, either fill all local users followers + // field or manually check if it's local and then do the .ends_with("/followers") + // TODO should also expand /following + // TODO should probably expand audience too but it's not reachable anymore from here, should we + // count audience field too in the .addressed() trait? maybe pre-expand it because it's + // only used for groups anyway?? if target.ends_with("/followers") { let target_id = target.replace("/followers", ""); let mut followers = crate::model::relation::Entity::followers(&target_id, tx)