Merge remote-tracking branch 'origin/master' into 0.5.1

v1.18.x
barisusakli 11 years ago
commit 3ab2e70e07

@ -5,6 +5,7 @@ var async = require('async'),
categories = require('../categories'),
privileges = require('../privileges'),
user = require('../user'),
websockets = require('./index'),
SocketCategories = {};
@ -73,4 +74,9 @@ SocketCategories.lastTopicIndex = function(socket, cid, callback) {
db.sortedSetCard('categories:' + cid + ':tid', callback);
};
SocketCategories.getUsersInCategory = function(socket, cid, callback) {
var uids = websockets.getUidsInRoom('category_' + cid);
user.getMultipleUserFields(uids, ['uid', 'userslug', 'username', 'picture'], callback);
};
module.exports = SocketCategories;

@ -287,17 +287,6 @@ function updateRoomBrowsingText(roomName) {
return;
}
function getUidsInRoom() {
var uids = [];
var clients = io.sockets.clients(roomName);
for(var i=0; i<clients.length; ++i) {
if (uids.indexOf(clients[i].uid) === -1 && clients[i].uid !== 0) {
uids.push(clients[i].uid);
}
}
return uids;
}
function getAnonymousCount() {
var clients = io.sockets.clients(roomName);
var anonCount = 0;
@ -310,7 +299,7 @@ function updateRoomBrowsingText(roomName) {
return anonCount;
}
var uids = getUidsInRoom(),
var uids = Sockets.getUidsInRoom(roomName),
anonymousCount = getAnonymousCount();
user.getMultipleUserFields(uids, ['uid', 'username', 'userslug', 'picture', 'status'], function(err, users) {
@ -328,6 +317,18 @@ function updateRoomBrowsingText(roomName) {
});
}
Sockets.getUidsInRoom = function(roomName) {
var uids = [];
var clients = io.sockets.clients(roomName);
for(var i=0; i<clients.length; ++i) {
if (uids.indexOf(clients[i].uid) === -1 && clients[i].uid !== 0) {
uids.push(clients[i].uid);
}
}
return uids;
};
Sockets.emitTopicPostStats = emitTopicPostStats;
function emitTopicPostStats(callback) {
db.getObjectFields('global', ['topicCount', 'postCount'], function(err, data) {

Loading…
Cancel
Save