mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-03 11:01:20 +01:00
fix: cache detection logic in context parseItem executing earlier than needed causing false positives
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user