mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-20 07:20:27 +01:00
refactor: get rid of post.exists check, if post doesnt exist content is falsy
This commit is contained in:
@@ -184,9 +184,6 @@ module.exports = function (Topics) {
|
|||||||
.filter(p => p && p.hasOwnProperty('toPid') && (activitypub.helpers.isUri(p.toPid) || utils.isNumber(p.toPid)))
|
.filter(p => p && p.hasOwnProperty('toPid') && (activitypub.helpers.isUri(p.toPid) || utils.isNumber(p.toPid)))
|
||||||
.map(postObj => postObj.toPid);
|
.map(postObj => postObj.toPid);
|
||||||
|
|
||||||
const exists = await posts.exists(parentPids);
|
|
||||||
parentPids = parentPids.filter((_, idx) => exists[idx]);
|
|
||||||
|
|
||||||
if (!parentPids.length) {
|
if (!parentPids.length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -212,7 +209,7 @@ module.exports = function (Topics) {
|
|||||||
parentPost.content = foundPost.content;
|
parentPost.content = foundPost.content;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
parentPost = await posts.parsePost(parentPost);
|
await posts.parsePost(parentPost);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const parents = {};
|
const parents = {};
|
||||||
@@ -230,7 +227,7 @@ module.exports = function (Topics) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
postData.forEach((post) => {
|
postData.forEach((post) => {
|
||||||
if (parents[post.toPid]) {
|
if (parents[post.toPid] && parents[post.toPid].content) {
|
||||||
post.parent = parents[post.toPid];
|
post.parent = parents[post.toPid];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user