Skip to content

Node.js based forum software built for the modern web

feat: if Update(Note) is received for a post that does not already exist, assert it

Julian Lam0bfdbb6a5c08
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',