mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-20 23:40:38 +01:00
dont add category/topic slug if user doesnt have read permission
or category is disabled etc.
This commit is contained in:
@@ -43,7 +43,7 @@ topicsController.get = function(req, res, next) {
|
||||
function (results, next) {
|
||||
userPrivileges = results.privileges;
|
||||
|
||||
if (userPrivileges.disabled || tid + '/' + req.params.slug !== results.topic.slug) {
|
||||
if (userPrivileges.disabled || (req.params.slug && tid + '/' + req.params.slug !== results.topic.slug)) {
|
||||
return helpers.notFound(req, res);
|
||||
}
|
||||
|
||||
@@ -51,6 +51,10 @@ topicsController.get = function(req, res, next) {
|
||||
return helpers.notAllowed(req, res);
|
||||
}
|
||||
|
||||
if (!req.params.slug && results.topic.slug && results.topic.slug !== tid + '/') {
|
||||
return helpers.redirect(res, '/topic/' + encodeURI(results.topic.slug));
|
||||
}
|
||||
|
||||
var settings = results.settings;
|
||||
var postCount = parseInt(results.topic.postcount, 10);
|
||||
var pageCount = Math.max(1, Math.ceil((postCount - 1) / settings.postsPerPage));
|
||||
|
||||
Reference in New Issue
Block a user