mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-03 11:01:20 +01:00
fix: guard against incomplete objects when building context/chain
This commit is contained in:
@@ -124,7 +124,7 @@ async function parseString(uid, item) {
|
||||
const { type, id } = await activitypub.helpers.resolveLocalId(item);
|
||||
const pid = type === 'post' && id ? id : item;
|
||||
const postData = await posts.getPostData(pid);
|
||||
if (postData) {
|
||||
if (postData && postData.pid) {
|
||||
// Already cached
|
||||
return postData;
|
||||
}
|
||||
@@ -157,7 +157,7 @@ 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) {
|
||||
if (postData && postData.pid) {
|
||||
// Already cached
|
||||
return postData;
|
||||
}
|
||||
|
||||
@@ -536,7 +536,7 @@ Notes.getParentChain = async (uid, input) => {
|
||||
}
|
||||
|
||||
const postData = await posts.getPostData(id);
|
||||
if (postData) {
|
||||
if (postData && postData.pid) {
|
||||
chain.add(postData);
|
||||
if (postData.toPid) {
|
||||
await traverse(uid, postData.toPid);
|
||||
|
||||
Reference in New Issue
Block a user