Merge pull request #4859 from BenLubar/topic-page-query

Fix /topic/:tid/:slug?page=:page for users with infinite scroll enabled
v1.18.x
Barış Soner Uşaklı 9 years ago committed by GitHub
commit 102e578b56

@ -260,7 +260,7 @@ define('forum/topic', [
Topic.replaceURLTimeout = 0;
if (history.replaceState) {
var search = (window.location.search ? window.location.search : '');
var search = (window.location.search && !/^\?page=\d+$/.test(window.location.search) ? window.location.search : '');
history.replaceState({
url: newUrl + search
}, null, window.location.protocol + '//' + window.location.host + RELATIVE_PATH + '/' + newUrl + search);

@ -97,7 +97,9 @@ topicsController.get = function(req, res, callback) {
req.params.post_index = 0;
}
if (!settings.usePagination) {
currentPage = 1;
if (req.params.post_index !== 0) {
currentPage = 1;
}
if (reverse) {
postIndex = Math.max(0, postCount - (req.params.post_index || postCount) - Math.ceil(settings.postsPerPage / 2));
} else {

Loading…
Cancel
Save