mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 06:25:50 +01:00
dont remove self from browsing
This commit is contained in:
@@ -9,7 +9,7 @@ define('forum/topic/browsing', function() {
|
|||||||
var Browsing = {};
|
var Browsing = {};
|
||||||
|
|
||||||
Browsing.onUpdateUsersInRoom = function(data) {
|
Browsing.onUpdateUsersInRoom = function(data) {
|
||||||
if(data && data.room.indexOf('topic_' + ajaxify.variables.get('topic_id')) !== -1) {
|
if (data && data.room.indexOf('topic_' + ajaxify.variables.get('topic_id')) !== -1) {
|
||||||
$('.browsing-users').toggleClass('hidden', !data.users.length);
|
$('.browsing-users').toggleClass('hidden', !data.users.length);
|
||||||
for(var i=0; i<data.users.length; ++i) {
|
for(var i=0; i<data.users.length; ++i) {
|
||||||
addUserIcon(data.users[i]);
|
addUserIcon(data.users[i]);
|
||||||
@@ -32,8 +32,10 @@ define('forum/topic/browsing', function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Browsing.onUserLeave = function(uid) {
|
Browsing.onUserLeave = function(uid) {
|
||||||
var activeEl = $('.thread_active_users');
|
if (app.user.uid === parseInt(uid, 10)) {
|
||||||
var user = activeEl.find('a[data-uid="' + uid + '"]');
|
return;
|
||||||
|
}
|
||||||
|
var user = $('.thread_active_users').find('a[data-uid="' + uid + '"]');
|
||||||
if (user.length) {
|
if (user.length) {
|
||||||
var count = Math.max(0, parseInt(user.attr('data-count'), 10) - 1);
|
var count = Math.max(0, parseInt(user.attr('data-count'), 10) - 1);
|
||||||
user.attr('data-count', count);
|
user.attr('data-count', count);
|
||||||
|
|||||||
@@ -278,9 +278,10 @@ Sockets.getUsersInRoom = function (uid, roomName, callback) {
|
|||||||
var uids = Sockets.getUidsInRoom(roomName);
|
var uids = Sockets.getUidsInRoom(roomName);
|
||||||
var total = uids.length;
|
var total = uids.length;
|
||||||
uids = uids.slice(0, 9);
|
uids = uids.slice(0, 9);
|
||||||
if (uid) {
|
if (uid && uids.indexOf(uid.toString()) === -1) {
|
||||||
uids = [uid].concat(uids);
|
uids = [uid].concat(uids);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!uids.length) {
|
if (!uids.length) {
|
||||||
return callback(null, {users: [], total: 0 , room: roomName});
|
return callback(null, {users: [], total: 0 , room: roomName});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user