mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-30 18:46:01 +01:00
fix: getParentChain error handling
This commit is contained in:
@@ -107,22 +107,22 @@ Notes.getParentChain = async (uid, input) => {
|
||||
let object;
|
||||
try {
|
||||
object = await activitypub.get('uid', uid, id);
|
||||
|
||||
// Handle incorrect id passed in
|
||||
if (id !== object.id) {
|
||||
return await traverse(uid, object.id);
|
||||
}
|
||||
|
||||
object = await activitypub.mocks.post(object);
|
||||
if (object) {
|
||||
chain.add(object);
|
||||
if (object.toPid) {
|
||||
await traverse(uid, object.toPid);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
winston.warn(`[activitypub/notes/getParentChain] Cannot retrieve ${id}, terminating here.`);
|
||||
}
|
||||
|
||||
// Handle incorrect id passed in
|
||||
if (id !== object.id) {
|
||||
return await traverse(uid, object.id);
|
||||
}
|
||||
|
||||
object = await activitypub.mocks.post(object);
|
||||
if (object) {
|
||||
chain.add(object);
|
||||
if (object.toPid) {
|
||||
await traverse(uid, object.toPid);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user