From 06e524ebeaaf94c2eb8d3695ce6d9f8e6daafb33 Mon Sep 17 00:00:00 2001 From: alemi Date: Thu, 9 Jan 2025 17:13:15 +0100 Subject: [PATCH] fix: don't notify when self reply/announce/like --- upub/core/src/traits/process.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/upub/core/src/traits/process.rs b/upub/core/src/traits/process.rs index ed35fd5..29e0464 100644 --- a/upub/core/src/traits/process.rs +++ b/upub/core/src/traits/process.rs @@ -83,7 +83,7 @@ pub async fn create(ctx: &crate::Context, activity: impl apb::Activity, tx: &Dat ctx.address(Some(&activity_model), Some(&object_model), tx).await?; for uid in notified { - if !ctx.is_local(&uid) { continue } + if !ctx.is_local(&uid) || uid == activity_model.actor { continue } if let Some(actor_internal) = crate::model::actor::Entity::ap_to_internal(&uid, tx).await? { crate::Query::notify(activity_model.internal, actor_internal) .exec(tx) @@ -138,7 +138,7 @@ pub async fn like(ctx: &crate::Context, activity: impl apb::Activity, tx: &Datab if let Some(aid) = aid { // TODO check that object author is in this like addressing!!! otherwise skip notification if let Some(ref attributed_to) = obj.attributed_to { - if ctx.is_local(attributed_to) { + if ctx.is_local(attributed_to) && actor.id != *attributed_to { if let Some(actor_internal) = crate::model::actor::Entity::ap_to_internal(attributed_to, tx).await? { crate::Query::notify(aid, actor_internal) .exec(tx) @@ -584,7 +584,7 @@ pub async fn announce(ctx: &crate::Context, activity: impl apb::Activity, tx: &D if let Some(aid) = aid { if let Some(ref attributed_to) = object.attributed_to { - if ctx.is_local(attributed_to) { + if ctx.is_local(attributed_to) && actor.id != *attributed_to { if let Some(actor_internal) = crate::model::actor::Entity::ap_to_internal(attributed_to, tx).await? { crate::Query::notify(aid, actor_internal) .exec(tx)