mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 17:16:14 +01:00
removed most of the debug
dont get more than 6 usernames for upvote tooltips generatePostPaths wont check null pids
This commit is contained in:
@@ -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
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user