removed most of the debug

dont get more than 6 usernames for upvote tooltips
generatePostPaths wont check null pids
This commit is contained in:
barisusakli
2014-09-06 20:46:18 -04:00
parent 0ad42873d5
commit 57e204df8e
7 changed files with 28 additions and 55 deletions

View File

@@ -254,23 +254,22 @@ SocketPosts.getPrivileges = function(socket, pid, callback) {
});
};
SocketPosts.getFavouritedUsers = function(socket, pid, callback) {
favourites.getFavouritedUidsByPids([pid], function(err, data) {
if (err || !Array.isArray(data) || !data.length) {
return callback(err);
}
user.getUsernamesByUids(data[0], callback);
});
};
SocketPosts.getUpvoters = function(socket, pid, callback) {
favourites.getUpvotedUidsByPids([pid], function(err, data) {
if (err || !Array.isArray(data) || !data.length) {
return callback(err, []);
}
user.getUsernamesByUids(data[0], callback);
var otherCount = 0;
if (data[0].length > 6) {
otherCount = data[0].length - 5;
data[0] = data[0].slice(0, 5);
}
user.getUsernamesByUids(data[0], function(err, usernames) {
callback(err, {
otherCount: otherCount,
usernames: usernames
});
});
});
};