mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: dont overwrite postIndex
if its not on the current page
This commit is contained in:
@@ -76,7 +76,11 @@ topicsController.get = async function getTopic(req, res, next) {
|
||||
if (!req.query.page) {
|
||||
currentPage = calculatePageFromIndex(postIndex, settings);
|
||||
} else {
|
||||
postIndex = ((currentPage - 1) * settings.postsPerPage) + 1;
|
||||
const top = ((currentPage - 1) * settings.postsPerPage) + 1;
|
||||
const bottom = top + settings.postsPerPage;
|
||||
if (!req.params.post_index || (postIndex < top || postIndex > bottom)) {
|
||||
postIndex = top;
|
||||
}
|
||||
}
|
||||
}
|
||||
const { start, stop } = calculateStartStop(currentPage, postIndex, settings);
|
||||
|
||||
Reference in New Issue
Block a user