Skip to content

Node.js based forum software built for the modern web

feat: on post delete, federate out an Update(Tombstone)

Julian Lam96db519b799a
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) {