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); }