|
|
|
@ -192,58 +192,30 @@ var async = require('async'),
|
|
|
|
|
var uids = mapFilter(topics, 'uid');
|
|
|
|
|
var cids = mapFilter(topics, 'cid');
|
|
|
|
|
|
|
|
|
|
var total = process.hrtime();
|
|
|
|
|
|
|
|
|
|
async.parallel({
|
|
|
|
|
users: function(next) {
|
|
|
|
|
var st = process.hrtime();
|
|
|
|
|
user.getMultipleUserFields(uids, ['uid', 'username', 'userslug', 'picture'], function(err, data) {
|
|
|
|
|
process.profile('users', st);
|
|
|
|
|
next(err, data);
|
|
|
|
|
});
|
|
|
|
|
user.getMultipleUserFields(uids, ['uid', 'username', 'userslug', 'picture'], next);
|
|
|
|
|
},
|
|
|
|
|
categories: function(next) {
|
|
|
|
|
var st = process.hrtime();
|
|
|
|
|
categories.getMultipleCategoryFields(cids, ['cid', 'name', 'slug', 'icon', 'bgColor', 'color', 'disabled'], function(err, data) {
|
|
|
|
|
process.profile('categories', st);
|
|
|
|
|
next(err, data);
|
|
|
|
|
});
|
|
|
|
|
categories.getMultipleCategoryFields(cids, ['cid', 'name', 'slug', 'icon', 'bgColor', 'color', 'disabled'], next);
|
|
|
|
|
},
|
|
|
|
|
hasRead: function(next) {
|
|
|
|
|
var st = process.hrtime();
|
|
|
|
|
Topics.hasReadTopics(tids, uid, function(err, data) {
|
|
|
|
|
process.profile('hasRead', st);
|
|
|
|
|
next(err, data);
|
|
|
|
|
});
|
|
|
|
|
Topics.hasReadTopics(tids, uid, next);
|
|
|
|
|
},
|
|
|
|
|
isAdminOrMod: function(next) {
|
|
|
|
|
var st = process.hrtime();
|
|
|
|
|
privileges.categories.isAdminOrMod(cids, uid, function(err, data) {
|
|
|
|
|
process.profile('isAdminOrMod', st);
|
|
|
|
|
next(err, data);
|
|
|
|
|
});
|
|
|
|
|
privileges.categories.isAdminOrMod(cids, uid, next);
|
|
|
|
|
},
|
|
|
|
|
teasers: function(next) {
|
|
|
|
|
var st = process.hrtime();
|
|
|
|
|
Topics.getTeasers(tids, uid, function(err, data) {
|
|
|
|
|
process.profile('teasers', st);
|
|
|
|
|
next(err, data);
|
|
|
|
|
});
|
|
|
|
|
Topics.getTeasers(tids, uid, next);
|
|
|
|
|
},
|
|
|
|
|
tags: function(next) {
|
|
|
|
|
var st = process.hrtime();
|
|
|
|
|
Topics.getTopicsTagsObjects(tids, function(err, data) {
|
|
|
|
|
process.profile('tags', st);
|
|
|
|
|
next(err, data);
|
|
|
|
|
});
|
|
|
|
|
Topics.getTopicsTagsObjects(tids, next);
|
|
|
|
|
}
|
|
|
|
|
}, function(err, results) {
|
|
|
|
|
if (err) {
|
|
|
|
|
return callback(err);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
process.profile('total', total);
|
|
|
|
|
|
|
|
|
|
var users = _.object(uids, results.users);
|
|
|
|
|
var categories = _.object(cids, results.categories);
|
|
|
|
|
var isAdminOrMod = {};
|
|
|
|
|