From f9affbad58551e2d7f05dd7a283c9427eb405237 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 21 Jan 2026 10:51:15 -0500 Subject: [PATCH] fix: cache detection logic in context parseItem executing earlier than needed causing false positives --- src/activitypub/contexts.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/activitypub/contexts.js b/src/activitypub/contexts.js index 2e346facc0..9b88104a38 100644 --- a/src/activitypub/contexts.js +++ b/src/activitypub/contexts.js @@ -143,14 +143,6 @@ async function parseString(uid, item) { } async function parseItem(uid, item) { - const { type, id } = await activitypub.helpers.resolveLocalId(item.id); - const pid = type === 'post' && id ? id : item.id; - const postData = await posts.getPostData(pid); - if (postData) { - // Already cached - return postData; - } - // Handle activity wrapper if (item.type === 'Create') { item = item.object; @@ -162,6 +154,14 @@ async function parseItem(uid, item) { return null; } + const { type, id } = await activitypub.helpers.resolveLocalId(item.id); + const pid = type === 'post' && id ? id : item.id; + const postData = await posts.getPostData(pid); + if (postData) { + // Already cached + return postData; + } + activitypub.helpers.log(`[activitypub/context] Parsing ${pid}`); return await activitypub.mocks.post(item); }