Skip to content

Commit 1794403

Browse files
committed
refactor: get rid of post.exists check, if post doesnt exist content is falsy
1 parent b5ea208 commit 1794403

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/topics/posts.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,6 @@ module.exports = function (Topics) {
184184
.filter(p => p && p.hasOwnProperty('toPid') && (activitypub.helpers.isUri(p.toPid) || utils.isNumber(p.toPid)))
185185
.map(postObj => postObj.toPid);
186186

187-
const exists = await posts.exists(parentPids);
188-
parentPids = parentPids.filter((_, idx) => exists[idx]);
189-
190187
if (!parentPids.length) {
191188
return;
192189
}
@@ -212,7 +209,7 @@ module.exports = function (Topics) {
212209
parentPost.content = foundPost.content;
213210
return;
214211
}
215-
parentPost = await posts.parsePost(parentPost);
212+
await posts.parsePost(parentPost);
216213
}));
217214

218215
const parents = {};
@@ -230,7 +227,7 @@ module.exports = function (Topics) {
230227
});
231228

232229
postData.forEach((post) => {
233-
if (parents[post.toPid]) {
230+
if (parents[post.toPid] && parents[post.toPid].content) {
234231
post.parent = parents[post.toPid];
235232
}
236233
});

0 commit comments

Comments
 (0)