Node.js based forum software built for the modern web
refactor: get rid of post.exists check, if post doesnt exist content is falsy
Barış Soner Uşaklı179440372aef
diff --git a/src/topics/posts.js b/src/topics/posts.jsindex 41b819d219..a8535939e9 100644--- a/src/topics/posts.js+++ b/src/topics/posts.js@@ -184,9 +184,6 @@ module.exports = function (Topics) {.filter(p => p && p.hasOwnProperty('toPid') && (activitypub.helpers.isUri(p.toPid) || utils.isNumber(p.toPid))).map(postObj => postObj.toPid);- const exists = await posts.exists(parentPids);- parentPids = parentPids.filter((_, idx) => exists[idx]);-if (!parentPids.length) {return;}@@ -212,7 +209,7 @@ module.exports = function (Topics) {parentPost.content = foundPost.content;return;}- parentPost = await posts.parsePost(parentPost);+ await posts.parsePost(parentPost);}));const parents = {};@@ -230,7 +227,7 @@ module.exports = function (Topics) {});postData.forEach((post) => {- if (parents[post.toPid]) {+ if (parents[post.toPid] && parents[post.toPid].content) {post.parent = parents[post.toPid];}});