correctly hide/show user in browsing users

v1.18.x
barisusakli 10 years ago
parent 924692404d
commit e592499d48

@ -185,7 +185,8 @@ app.cacheBuster = null;
enter: room,
username: app.user.username,
userslug: app.user.userslug,
picture: app.user.picture
picture: app.user.picture,
status: app.user.status
}, function(err) {
if (err) {
app.alertError(err.message);
@ -454,6 +455,7 @@ app.cacheBuster = null;
return app.alertError(err.message);
}
$('#logged-in-menu #user_label #user-profile-link>i').attr('class', 'fa fa-circle status ' + status);
app.user.status = status;
});
e.preventDefault();
});

@ -4,7 +4,7 @@
/* globals define, app, config, socket, ajaxify */
define('forum/topic/browsing', ['translator'], function(translator) {
define('forum/topic/browsing', function() {
var Browsing = {};
@ -29,6 +29,7 @@ define('forum/topic/browsing', ['translator'], function(translator) {
} else {
increaseUserCount(1);
}
Browsing.onUserStatusChange(data);
};
Browsing.onUserLeave = function(uid) {
@ -56,8 +57,8 @@ define('forum/topic/browsing', ['translator'], function(translator) {
function updateBrowsingUsers(data) {
var activeEl = $('[component="topic/browsing/list"]');
var user = activeEl.find('a[data-uid="'+ data.uid + '"]');
if (user.length && data.status === 'offline') {
user.parent().remove();
if (user.length) {
user.parent().toggleClass('hidden', data.status === 'offline');
}
}

Loading…
Cancel
Save