mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 12:05:57 +01:00
closes #942
This commit is contained in:
@@ -514,7 +514,7 @@ module.exports.server = server;
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/topic/:topic_id/:slug?', function (req, res) {
|
app.get('/topic/:topic_id/:slug?', function (req, res, next) {
|
||||||
var tid = req.params.topic_id;
|
var tid = req.params.topic_id;
|
||||||
|
|
||||||
if (tid.match(/^\d+\.rss$/)) {
|
if (tid.match(/^\d+\.rss$/)) {
|
||||||
@@ -531,24 +531,33 @@ module.exports.server = server;
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!fs.existsSync(rssPath)) {
|
ThreadTools.privileges(tid, ((req.user) ? req.user.uid || 0 : 0), function(err, privileges) {
|
||||||
feed.updateTopic(tid, function (err) {
|
if(err) {
|
||||||
if (err) {
|
return next(err);
|
||||||
res.redirect('/404');
|
}
|
||||||
} else {
|
|
||||||
loadFeed();
|
if(!privileges.read) {
|
||||||
}
|
return res.redirect('403');
|
||||||
});
|
}
|
||||||
} else {
|
|
||||||
loadFeed();
|
if (!fs.existsSync(rssPath)) {
|
||||||
}
|
feed.updateTopic(tid, function (err) {
|
||||||
|
if (err) {
|
||||||
|
res.redirect('/404');
|
||||||
|
} else {
|
||||||
|
loadFeed();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
loadFeed();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function(next) {
|
function(next) {
|
||||||
// Check whether this user is allowed to access this topic
|
|
||||||
ThreadTools.privileges(tid, ((req.user) ? req.user.uid || 0 : 0), function(err, privileges) {
|
ThreadTools.privileges(tid, ((req.user) ? req.user.uid || 0 : 0), function(err, privileges) {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
if (!privileges.read) {
|
if (!privileges.read) {
|
||||||
@@ -687,7 +696,7 @@ module.exports.server = server;
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/category/:category_id/:slug?', function (req, res) {
|
app.get('/category/:category_id/:slug?', function (req, res, next) {
|
||||||
var cid = req.params.category_id;
|
var cid = req.params.category_id;
|
||||||
|
|
||||||
if (cid.match(/^\d+\.rss$/)) {
|
if (cid.match(/^\d+\.rss$/)) {
|
||||||
@@ -704,24 +713,33 @@ module.exports.server = server;
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!fs.existsSync(rssPath)) {
|
CategoryTools.privileges(cid, ((req.user) ? req.user.uid || 0 : 0), function(err, privileges) {
|
||||||
feed.updateCategory(cid, function (err) {
|
if(err) {
|
||||||
if (err) {
|
return next(err);
|
||||||
res.redirect('/404');
|
}
|
||||||
} else {
|
|
||||||
loadFeed();
|
if(!privileges.read) {
|
||||||
}
|
return res.redirect('403');
|
||||||
});
|
}
|
||||||
} else {
|
|
||||||
loadFeed();
|
if (!fs.existsSync(rssPath)) {
|
||||||
}
|
feed.updateCategory(cid, function (err) {
|
||||||
|
if (err) {
|
||||||
|
res.redirect('/404');
|
||||||
|
} else {
|
||||||
|
loadFeed();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
loadFeed();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function(next) {
|
function(next) {
|
||||||
// Check whether this user is allowed to access this category
|
|
||||||
CategoryTools.privileges(cid, ((req.user) ? req.user.uid || 0 : 0), function(err, privileges) {
|
CategoryTools.privileges(cid, ((req.user) ? req.user.uid || 0 : 0), function(err, privileges) {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
if (!privileges.read) {
|
if (!privileges.read) {
|
||||||
|
|||||||
Reference in New Issue
Block a user