mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 03:26:04 +01:00
getTopicWithPosts change, fix feeds
This commit is contained in:
@@ -36,12 +36,12 @@ topicsController.get = function(req, res, callback) {
|
||||
user.getSettings(req.uid, next);
|
||||
},
|
||||
topic: function(next) {
|
||||
topics.getTopicFields(tid, ['slug', 'postcount', 'deleted'], next);
|
||||
topics.getTopicData(tid, next);
|
||||
}
|
||||
}, next);
|
||||
},
|
||||
function (results, next) {
|
||||
if (!results.topic.slug) {
|
||||
if (!results.topic) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
@@ -106,26 +106,19 @@ topicsController.get = function(req, res, callback) {
|
||||
currentPage = Math.max(1, Math.ceil(index / settings.postsPerPage));
|
||||
}
|
||||
|
||||
var start = (currentPage - 1) * settings.postsPerPage + postIndex,
|
||||
stop = start + settings.postsPerPage - 1;
|
||||
var start = (currentPage - 1) * settings.postsPerPage + postIndex;
|
||||
var stop = start + settings.postsPerPage - 1;
|
||||
|
||||
topics.getTopicWithPosts(tid, set, req.uid, start, stop, reverse, function (err, topicData) {
|
||||
if (err && err.message === '[[error:no-topic]]' && !topicData) {
|
||||
return callback();
|
||||
}
|
||||
topics.getTopicWithPosts(results.topic, set, req.uid, start, stop, reverse, next);
|
||||
},
|
||||
function (topicData, next) {
|
||||
if (topicData.category.disabled) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
if (err && !topicData) {
|
||||
return next(err);
|
||||
}
|
||||
topics.modifyByPrivilege(topicData.posts, userPrivileges);
|
||||
|
||||
if (topicData.category.disabled) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
topics.modifyByPrivilege(topicData.posts, results.privileges);
|
||||
|
||||
plugins.fireHook('filter:controllers.topic.get', {topicData: topicData, uid: req.uid}, next);
|
||||
});
|
||||
plugins.fireHook('filter:controllers.topic.get', {topicData: topicData, uid: req.uid}, next);
|
||||
},
|
||||
function (data, next) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user