fix: handle start=0 stop=0 for topics.getTopicPosts

add more tests
This commit is contained in:
Barış Soner Uşaklı
2021-12-06 16:36:30 -05:00
parent 621c142f8e
commit 906dc5675e
4 changed files with 42 additions and 5 deletions

View File

@@ -39,7 +39,10 @@ module.exports = function (Topics) {
repliesStart -= 1;
}
}
const pids = await posts.getPidsFromSet(set, repliesStart, repliesStop, reverse);
let pids = [];
if (start !== 0 || stop !== 0) {
pids = await posts.getPidsFromSet(set, repliesStart, repliesStop, reverse);
}
if (!pids.length && !topicOrTid.mainPid) {
return [];
}