fix: replace parseInt that was excluding remote pids from calculation

Also fixes nodebb/nodebb-plugin-feed#13
This commit is contained in:
Julian Lam
2024-11-20 13:49:55 -05:00
parent 0f351ba70d
commit 93bb73c17e

View File

@@ -281,7 +281,8 @@ module.exports = function (Topics) {
Topics.getTopicField(tid, 'mainPid'), Topics.getTopicField(tid, 'mainPid'),
db.getSortedSetRange(`tid:${tid}:posts`, 0, -1), db.getSortedSetRange(`tid:${tid}:posts`, 0, -1),
]); ]);
if (parseInt(mainPid, 10)) { const mainPidExists = await posts.exists(mainPid);
if (mainPidExists) {
pids = [mainPid].concat(pids); pids = [mainPid].concat(pids);
} }
return pids; return pids;