Merge branch 'master' of github.com:designcreateplay/NodeBB

v1.18.x
Julian Lam 11 years ago
commit e8d6df22cb

@ -18,6 +18,13 @@ define(function() {
};
Admin.updateRoomUsage = function(err, data) {
function getUserCountIn(room) {
var count = 0;
for(var user in data[room]) {
++count;
}
return count;
}
var active_users = $('#active_users'),
total = 0;
@ -31,7 +38,7 @@ define(function() {
for (var room in data) {
if (room !== '') {
var count = $(data[room]).length;
var count = getUserCountIn(room);
total += count;
usersHtml += "<div class='alert alert-success'><strong>" + room + "</strong> " + count + " active user" + (count > 1 ? "s" : "") + "</div>";
}

@ -537,7 +537,8 @@ define(['composer'], function(composer) {
socket.on('get_users_in_room', function(data) {
if(data) {
if(data && data.room.indexOf('topic') !== -1) {
var activeEl = $('.thread_active_users');
function createUserIcon(uid, picture, userslug, username) {

@ -1,6 +1,6 @@
<div class="composer">
<div class="composer-container">
<input class="title" type="text" tabIndex="1" placeholder="Enter your topic title here..." />
<input class="title form-control" type="text" tabIndex="1" placeholder="Enter your topic title here..." />
<div class="btn-toolbar formatting-bar">
<div class="btn-group">
<span class="btn btn-link" tabindex="-1"><i class="fa fa-bold"></i></span>
@ -24,7 +24,7 @@
<li><a data-pane=".tab-preview" data-toggle="tab">Preview</a></li>
<li class="btn-group pull-right action-bar">
<button class="btn btn-default" data-action="discard" tabIndex="5"><i class="fa fa-times"></i> Discard</button>
<button data-action="post" class="btn btn-default" tabIndex="3"><i class="fa fa-check"></i> Submit</button>
<button data-action="post" class="btn btn-default btn-primary" tabIndex="3"><i class="fa fa-check"></i> Submit</button>
</li>
</ul>

@ -94,7 +94,11 @@ Sockets.init = function() {
});
}
io.sockets.in('global').emit('user.isOnline', isUserOnline(uid));
socket.broadcast.emit('user.isOnline', null, {
online: isUserOnline(uid),
uid: uid,
timestamp: Date.now()
});
});
});
@ -114,7 +118,11 @@ Sockets.init = function() {
}
}
io.sockets.in('global').emit('user.isOnline', isUserOnline(uid));
socket.broadcast.emit('user.isOnline', null, {
online: isUserOnline(uid),
uid: uid,
timestamp: Date.now()
});
emitOnlineUserCount();
@ -190,7 +198,6 @@ Sockets.emitUserCount = function() {
});
};
// Use sessionData.server.sockets.in() instead of this method.
Sockets.in = function(room) {
return io.sockets.in(room);
};
@ -239,15 +246,15 @@ function updateRoomBrowsingText(roomName) {
var uids = getUidsInRoom(Sockets.rooms[roomName]),
anonymousCount = getAnonymousCount(roomName);
if (uids.length === 0) {
io.sockets.in(roomName).emit('get_users_in_room', { users: [], anonymousCount: anonymousCount });
} else {
user.getMultipleUserFields(uids, ['uid', 'username', 'userslug', 'picture'], function(err, users) {
if(!err) {
io.sockets.in(roomName).emit('get_users_in_room', { users: users, anonymousCount: anonymousCount });
}
});
}
user.getMultipleUserFields(uids, ['uid', 'username', 'userslug', 'picture'], function(err, users) {
if(!err) {
io.sockets.in(roomName).emit('get_users_in_room', {
users: users,
anonymousCount: anonymousCount,
room: roomName
});
}
});
}
Sockets.emitTopicPostStats = emitTopicPostStats;

@ -91,6 +91,9 @@ SocketMeta.rooms.enter = function(socket, data) {
if (data.leave && server.rooms[data.leave] && server.rooms[data.leave][socket.id] && data.enter !== data.leave) {
delete server.rooms[data.leave][socket.id];
if(!Object.keys(server.rooms[data.leave]).length) {
delete server.rooms[data.leave];
}
}
}

Loading…
Cancel
Save