From ab1ca489bea447a2181a64804545f9dba0bffadb Mon Sep 17 00:00:00 2001 From: alemi Date: Mon, 24 Jun 2024 03:02:13 +0200 Subject: [PATCH] fix: insert undo activities or nuke doesnt work ............. --- upub/core/src/traits/process.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/upub/core/src/traits/process.rs b/upub/core/src/traits/process.rs index e514f9d7..ff92f85b 100644 --- a/upub/core/src/traits/process.rs +++ b/upub/core/src/traits/process.rs @@ -318,7 +318,7 @@ pub async fn update(ctx: &crate::Context, activity: impl apb::Activity, tx: &Dat Ok(()) } -pub async fn undo(_ctx: &crate::Context, activity: impl apb::Activity, tx: &DatabaseTransaction) -> Result<(), ProcessorError> { +pub async fn undo(ctx: &crate::Context, activity: impl apb::Activity, tx: &DatabaseTransaction) -> Result<(), ProcessorError> { // TODO in theory we could work with just object_id but right now only accept embedded let undone_activity = activity.object() .extract() @@ -393,6 +393,10 @@ pub async fn undo(_ctx: &crate::Context, activity: impl apb::Activity, tx: &Data _ => return Err(ProcessorError::Unprocessable(activity.id()?.to_string())), } + if ctx.is_local(activity.id()?) { + ctx.insert_activity(activity, tx).await?; + } + Ok(()) }