Node.js based forum software built for the modern web
fix: cache detection logic in context parseItem executing earlier than needed causing false positives
Julian Lamf9affbad5855
diff --git a/src/activitypub/contexts.js b/src/activitypub/contexts.jsindex 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 wrapperif (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);}