|
|
|
@ -222,21 +222,31 @@ var async = require('async'),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Posts.getUserInfoForPosts = function(uids, callback) {
|
|
|
|
|
user.getMultipleUserFields(uids, ['uid', 'username', 'userslug', 'reputation', 'postcount', 'picture', 'signature', 'banned'], function(err, userData) {
|
|
|
|
|
async.parallel({
|
|
|
|
|
groups: function(next) {
|
|
|
|
|
groups.getUserGroups(uids, next);
|
|
|
|
|
},
|
|
|
|
|
userData: function(next) {
|
|
|
|
|
user.getMultipleUserFields(uids, ['uid', 'username', 'userslug', 'reputation', 'postcount', 'picture', 'signature', 'banned'], next);
|
|
|
|
|
}
|
|
|
|
|
}, function(err, results) {
|
|
|
|
|
if (err) {
|
|
|
|
|
return callback(err);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var userData = results.userData;
|
|
|
|
|
for(var i=0; i<userData.length; ++i) {
|
|
|
|
|
userData[i].groups = results.groups[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async.map(userData, function(userData, next) {
|
|
|
|
|
var userInfo = {
|
|
|
|
|
uid: userData.uid || 0,
|
|
|
|
|
username: userData.username || '[[global:guest]]',
|
|
|
|
|
userslug: userData.userslug || '',
|
|
|
|
|
reputation: userData.reputation || 0,
|
|
|
|
|
postcount: userData.postcount || 0,
|
|
|
|
|
banned: parseInt(userData.banned, 10) === 1,
|
|
|
|
|
picture: userData.picture || user.createGravatarURLFromEmail('')
|
|
|
|
|
};
|
|
|
|
|
userData.uid = userData.uid || 0;
|
|
|
|
|
userData.username = userData.username || '[[global:guest]]';
|
|
|
|
|
userData.userslug = userData.userslug || '';
|
|
|
|
|
userData.reputation = userData.reputation || 0;
|
|
|
|
|
userData.postcount = userData.postcount || 0;
|
|
|
|
|
userData.banned = parseInt(userData.banned, 10) === 1;
|
|
|
|
|
userData.picture = userData.picture || user.createGravatarURLFromEmail('');
|
|
|
|
|
|
|
|
|
|
async.parallel({
|
|
|
|
|
signature: function(next) {
|
|
|
|
@ -247,18 +257,14 @@ var async = require('async'),
|
|
|
|
|
},
|
|
|
|
|
customProfileInfo: function(next) {
|
|
|
|
|
plugins.fireHook('filter:posts.custom_profile_info', {profile: [], uid: userData.uid}, next);
|
|
|
|
|
},
|
|
|
|
|
groups: function(next) {
|
|
|
|
|
groups.getUserGroups(userData.uid, next);
|
|
|
|
|
}
|
|
|
|
|
}, function(err, results) {
|
|
|
|
|
if (err) {
|
|
|
|
|
return next(err);
|
|
|
|
|
}
|
|
|
|
|
userInfo.signature = results.signature;
|
|
|
|
|
userInfo.custom_profile_info = results.customProfileInfo.profile;
|
|
|
|
|
userInfo.groups = results.groups;
|
|
|
|
|
next(null, userInfo);
|
|
|
|
|
userData.signature = results.signature;
|
|
|
|
|
userData.custom_profile_info = results.customProfileInfo.profile;
|
|
|
|
|
next(null, userData);
|
|
|
|
|
});
|
|
|
|
|
}, callback);
|
|
|
|
|
});
|
|
|
|
|