moved isAdminOrMod check out of getTopicsByTids

This commit is contained in:
barisusakli
2014-11-16 16:15:49 -05:00
parent a75727bbbd
commit 8e114c2093
6 changed files with 82 additions and 122 deletions

View File

@@ -20,20 +20,17 @@ module.exports = function(Topics) {
};
Topics.getLatestTopics = function(uid, start, end, term, callback) {
Topics.getLatestTids(start, end, term, function(err, tids) {
if (err) {
return callback(err);
async.waterfall([
function (next) {
Topics.getLatestTids(start, end, term, next);
},
function(tids, next) {
Topics.getTopics(tids, uid, next);
},
function(topics, next) {
next(null, {topics: topics, nextStart: end + 1});
}
Topics.getTopics(tids, uid, function(err, data) {
if (err) {
return callback(err);
}
data.nextStart = end + 1;
callback(null, data);
});
});
], callback);
};
Topics.getLatestTids = function(start, end, term, callback) {