From 0bfdbb6a5c089a5f2f1599e33844568b99580096 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 13 Mar 2024 15:05:42 -0400 Subject: [PATCH] feat: if Update(Note) is received for a post that does not already exist, assert it --- src/activitypub/inbox.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/activitypub/inbox.js b/src/activitypub/inbox.js index 25c940fa34..6c860f79c9 100644 --- a/src/activitypub/inbox.js +++ b/src/activitypub/inbox.js @@ -43,8 +43,13 @@ inbox.update = async (req) => { switch (object.type) { case 'Note': { const postData = await activitypub.mocks.post(object); + const exists = await posts.exists(object.id); try { - await posts.edit(postData); + if (exists) { + await posts.edit(postData); + } else { + await activitypub.notes.assertTopic(0, object.id); + } } catch (e) { activitypub.send('uid', 0, actor, { type: 'Reject',