mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-08-26 23:47:04 +02:00
closes #1924
This commit is contained in:
@@ -70,11 +70,13 @@ categoriesController.get = function(req, res, next) {
|
||||
|
||||
async.waterfall([
|
||||
function(next) {
|
||||
categories.getCategoryField(cid, 'disabled', function(err, disabled) {
|
||||
next(disabled === '1' ? new Error('category-disabled') : undefined);
|
||||
});
|
||||
categories.getCategoryField(cid, 'disabled', next);
|
||||
},
|
||||
function(next) {
|
||||
function(disabled, next) {
|
||||
if (parseInt(disabled, 10) === 1) {
|
||||
return next(new Error('category-disabled'));
|
||||
}
|
||||
|
||||
privileges.categories.get(cid, uid, function(err, categoryPrivileges) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
@@ -163,11 +165,7 @@ categoriesController.get = function(req, res, next) {
|
||||
}
|
||||
], function (err, data) {
|
||||
if (err) {
|
||||
if (err.message === '[[error:no-privileges]]') {
|
||||
return res.locals.isAPI ? res.json(403, err.message) : res.redirect('403');
|
||||
} else {
|
||||
return res.locals.isAPI ? res.json(404, 'not-found') : res.redirect('404');
|
||||
}
|
||||
return res.locals.isAPI ? res.json(404, 'not-found') : res.redirect(nconf.get('relative_path') + '/404');
|
||||
}
|
||||
|
||||
if (data.link) {
|
||||
|
||||
@@ -30,7 +30,7 @@ groupsController.details = function(req, res) {
|
||||
if (!err) {
|
||||
res.render('groups/details', results);
|
||||
} else {
|
||||
res.redirect('404');
|
||||
res.redirect(nconf.get('relative_path') + '/404')
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -188,7 +188,7 @@ Controllers.confirmEmail = function(req, res, next) {
|
||||
|
||||
Controllers.sitemap = function(req, res, next) {
|
||||
if (meta.config['feeds:disableSitemap'] === '1') {
|
||||
return res.redirect('404');
|
||||
return res.redirect(nconf.get('relative_path') + '/404')
|
||||
}
|
||||
|
||||
var sitemap = require('../sitemap.js');
|
||||
|
||||
@@ -24,7 +24,7 @@ topicsController.get = function(req, res, next) {
|
||||
privileges.topics.get(tid, uid, next);
|
||||
},
|
||||
function (privileges, next) {
|
||||
if (!privileges.read) {
|
||||
if (!privileges.read || privileges.disabled) {
|
||||
return next(new Error('[[error:no-privileges]]'));
|
||||
}
|
||||
|
||||
@@ -164,11 +164,7 @@ topicsController.get = function(req, res, next) {
|
||||
}
|
||||
], function (err, data) {
|
||||
if (err) {
|
||||
if (err.message === '[[error:no-privileges]]') {
|
||||
return res.locals.isAPI ? res.json(403, err.message) : res.redirect('403');
|
||||
} else {
|
||||
return res.locals.isAPI ? res.json(404, 'not-found') : res.redirect('404');
|
||||
}
|
||||
return res.locals.isAPI ? res.json(404, 'not-found') : res.redirect(nconf.get('relative_path') + '/404');
|
||||
}
|
||||
|
||||
data.privileges = userPrivileges;
|
||||
|
||||
Reference in New Issue
Block a user