From f8d012c81c7d9fa1141eed8940db828ee9af9861 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Mon, 5 May 2025 17:01:07 -0400 Subject: [PATCH] fix: AP inbox update handling for non-note objects --- src/activitypub/inbox.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/activitypub/inbox.js b/src/activitypub/inbox.js index f8ebc250c7..9094d077b1 100644 --- a/src/activitypub/inbox.js +++ b/src/activitypub/inbox.js @@ -84,8 +84,8 @@ inbox.update = async (req) => { throw new Error('[[error:activitypub.origin-mismatch]]'); } - switch (object.type) { - case 'Note': { + switch (true) { + case activitypub._constants.acceptedPostTypes.includes(object.type): { const [isNote, isMessage] = await Promise.all([ posts.exists(object.id), messaging.messageExists(object.id), @@ -136,16 +136,12 @@ inbox.update = async (req) => { break; } - case 'Application': // falls through - case 'Group': // falls through - case 'Organization': // falls through - case 'Service': // falls through - case 'Person': { + case activitypub._constants.acceptableActorTypes.has(object.type): { await activitypub.actors.assert(object.id, { update: true }); break; } - case 'Tombstone': { + case object.type === 'Tombstone': { const [isNote, isMessage/* , isActor */] = await Promise.all([ posts.exists(object.id), messaging.messageExists(object.id),