From 3db892f0386de41dd930f1738f031029c497e7d4 Mon Sep 17 00:00:00 2001 From: alemi Date: Wed, 12 Jun 2024 06:07:34 +0200 Subject: [PATCH] fix: cheap way to make public activities public --- upub/core/src/traits/address.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/upub/core/src/traits/address.rs b/upub/core/src/traits/address.rs index 53eaa186..29b27b68 100644 --- a/upub/core/src/traits/address.rs +++ b/upub/core/src/traits/address.rs @@ -60,7 +60,12 @@ impl Addresser for crate::Context { } async fn address_activity(&self, activity: &crate::model::activity::Model, tx: &impl ConnectionTrait) -> Result<(), DbErr> { - let to = expand_addressing(activity.mentioning(), tx).await?; + let mut to = expand_addressing(activity.mentioning(), tx).await?; + if !to.iter().any(|x| x == apb::target::PUBLIC) + && activity.addressed().iter().any(|x| x == apb::target::PUBLIC) + { + to.push(apb::target::PUBLIC.to_string()); + } address_to(self, to, Some(activity.internal), None, self.is_local(&activity.id), tx).await } }