Node.js based forum software built for the modern web
#1848
barisusaklie97bfc139bab
diff --git a/public/src/modules/navigator.js b/public/src/modules/navigator.jsindex 5528b78b51..cfccbb871d 100644--- a/public/src/modules/navigator.js+++ b/public/src/modules/navigator.js@@ -152,7 +152,7 @@ define('navigator', ['forum/pagination'], function(pagination) {}navigator.scrollToPost = function(postIndex, highlight, duration, offset) {- if (!utils.isNumber(postIndex)) {+ if (!utils.isNumber(postIndex) || !$('.post-container').length) {return;}diff --git a/src/controllers/topics.js b/src/controllers/topics.jsindex 7be21fd793..c816f29ecb 100644--- a/src/controllers/topics.js+++ b/src/controllers/topics.js@@ -44,18 +44,6 @@ topicsController.get = function(req, res, next) {},function (results, next) {- var postCount = parseInt(results.postCount, 10);- if (utils.isNumber(req.params.post_index)) {- var url = '';- if (req.params.post_index > postCount) {- url = '/topic/' + req.params.topic_id + '/' + req.params.slug + '/' + postCount;- return res.locals.isAPI ? res.status(302).json(url) : res.redirect(url);- } else if (req.params.post_index < 1) {- url = '/topic/' + req.params.topic_id + '/' + req.params.slug;- return res.locals.isAPI ? res.status(302).json(url) : res.redirect(url);- }- }-userPrivileges = results.privileges;if (userPrivileges.disabled) {@@ -70,6 +58,18 @@ topicsController.get = function(req, res, next) {return categoriesController.notAllowed(req, res);}+ var postCount = parseInt(results.postCount, 10);+ if (utils.isNumber(req.params.post_index)) {+ var url = '';+ if (req.params.post_index > postCount) {+ url = '/topic/' + req.params.topic_id + '/' + req.params.slug + '/' + postCount;+ return res.locals.isAPI ? res.status(302).json(url) : res.redirect(url);+ } else if (req.params.post_index < 1) {+ url = '/topic/' + req.params.topic_id + '/' + req.params.slug;+ return res.locals.isAPI ? res.status(302).json(url) : res.redirect(url);+ }+ }+var settings = results.settings;var set = 'tid:' + tid + ':posts',reverse = false;