mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-08 17:31:51 +02:00
fix: handle start=0 stop=0 for topics.getTopicPosts
add more tests
This commit is contained in:
@@ -30,9 +30,7 @@ module.exports = function (SocketTopics) {
|
||||
parseInt(data.count, 10) || meta.config.postsPerPage || 20
|
||||
));
|
||||
|
||||
if (data.direction === 1) {
|
||||
start += 1;
|
||||
} else if (data.direction === -1) {
|
||||
if (data.direction === -1) {
|
||||
start -= infScrollPostsPerPage;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 [];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user