From 179440372aef747f824b91e5fa023d1e269f22eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Thu, 30 Oct 2025 20:34:01 -0400 Subject: [PATCH] refactor: get rid of post.exists check, if post doesnt exist content is falsy --- src/topics/posts.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/topics/posts.js b/src/topics/posts.js index 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]; } });