mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +01:00
fix: missing await, and handle local posts with no toPid (i.e. reply to OP)
This commit is contained in:
@@ -136,7 +136,7 @@ Notes.getParentChain = async (uid, input) => {
|
|||||||
// Handle remote reference to local post
|
// Handle remote reference to local post
|
||||||
const { type, id: localId } = await activitypub.helpers.resolveLocalId(id);
|
const { type, id: localId } = await activitypub.helpers.resolveLocalId(id);
|
||||||
if (type === 'post' && localId) {
|
if (type === 'post' && localId) {
|
||||||
return traverse(uid, localId);
|
return await traverse(uid, localId);
|
||||||
}
|
}
|
||||||
|
|
||||||
const exists = await db.exists(`post:${id}`);
|
const exists = await db.exists(`post:${id}`);
|
||||||
@@ -145,6 +145,11 @@ Notes.getParentChain = async (uid, input) => {
|
|||||||
chain.add(postData);
|
chain.add(postData);
|
||||||
if (postData.toPid) {
|
if (postData.toPid) {
|
||||||
await traverse(uid, postData.toPid);
|
await traverse(uid, postData.toPid);
|
||||||
|
} else if (utils.isNumber(id)) { // local pid without toPid, could be OP or reply to OP
|
||||||
|
const mainPid = await topics.getTopicField(postData.tid, 'mainPid');
|
||||||
|
if (mainPid !== id) {
|
||||||
|
await traverse(uid, mainPid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let object;
|
let object;
|
||||||
|
|||||||
Reference in New Issue
Block a user