From 96db519b799a3dd435eb53ba2bdc96ba66c2168e Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 7 May 2024 12:37:57 -0400 Subject: [PATCH] feat: on post delete, federate out an Update(Tombstone) --- src/api/activitypub.js | 2 +- src/api/posts.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/api/activitypub.js b/src/api/activitypub.js index 7bbff96920..0cadad9cbe 100644 --- a/src/api/activitypub.js +++ b/src/api/activitypub.js @@ -193,7 +193,7 @@ activitypubApi.update.note = enabledCheck(async (caller, { post }) => { } const payload = { - id: `${object.id}#activity/update/${post.edited}`, + id: `${object.id}#activity/update/${post.edited || Date.now()}`, type: 'Update', to: object.to, cc: object.cc, diff --git a/src/api/posts.js b/src/api/posts.js index 741846f73a..bd165d3c7d 100644 --- a/src/api/posts.js +++ b/src/api/posts.js @@ -193,6 +193,11 @@ async function deleteOrRestore(caller, data, params) { tid: postData.tid, ip: caller.ip, }); + + // Explicitly non-awaited + posts.getPostSummaryByPids([data.pid], caller.uid, {}).then(([post]) => { + require('.').activitypub.update.note(caller, { post }); + }); } async function deleteOrRestoreTopicOf(command, pid, caller) {