From 4e8a9fbe27149491c91642cc68cfa941848439ba Mon Sep 17 00:00:00 2001 From: barisusakli Date: Mon, 26 May 2014 14:49:04 -0400 Subject: [PATCH] closes #1582 --- public/src/forum/topic/browsing.js | 5 ++--- src/socket.io/index.js | 14 ++++++++++++++ src/user.js | 7 ++++--- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/public/src/forum/topic/browsing.js b/public/src/forum/topic/browsing.js index dcd270beff..460d450e96 100644 --- a/public/src/forum/topic/browsing.js +++ b/public/src/forum/topic/browsing.js @@ -9,7 +9,7 @@ define(function() { var Browsing = {}; Browsing.onUpdateUsersInRoom = function(data) { - if(data && data.room.indexOf('topic') !== -1) { + if(data && data.room.indexOf('topic_' + ajaxify.variables.get('topic_id')) !== -1) { var activeEl = $('.thread_active_users'); // remove users that are no longer here @@ -92,7 +92,7 @@ define(function() { var user = activeEl.find('a[data-uid="'+ data.uid + '"]'); if (user.length && !data.online) { user.parent().remove(); - } else if(!user.length && data.online) { + } else if(!user.length && data.online && data.rooms.indexOf('topic_' + ajaxify.variables.get('topic_id')) !== -1) { user = createUserIcon(data.uid, data.picture, data.userslug, data.username); activeEl.append(user); activeEl.find('a[data-uid] img').tooltip({ @@ -107,7 +107,6 @@ define(function() { } } - function getReplyingUsers() { var activeEl = $('.thread_active_users'); socket.emit('modules.composer.getUsersByTid', ajaxify.variables.get('topic_id'), function(err, uids) { diff --git a/src/socket.io/index.js b/src/socket.io/index.js index 1de64d2a32..a5f9bd9d18 100644 --- a/src/socket.io/index.js +++ b/src/socket.io/index.js @@ -228,6 +228,20 @@ Sockets.getUserSockets = function(uid) { return sockets; }; +Sockets.getUserRooms = function(uid) { + var sockets = Sockets.getUserSockets(uid); + var rooms = {}; + for (var i=0; i