dont show invisible users in online users page

This commit is contained in:
Baris Soner Usakli
2014-01-31 15:47:26 -05:00
parent 700876fe58
commit 52962a7e9b
3 changed files with 39 additions and 23 deletions

View File

@@ -52,8 +52,6 @@ define(function() {
return app.alert(err.message);
}
console.log(data);
if (!data) {
$('#user-notfound-notify').html('You need to be logged in to search!');
$('#user-notfound-notify').parent().addClass('btn-warning label-warning');
@@ -83,7 +81,7 @@ define(function() {
});
socket.on('user.isOnline', function(err, data) {
if(getActiveSection() == 'online' && !loadingMoreUsers) {
if(getActiveSection().indexOf('online') === 0 && !loadingMoreUsers) {
startLoading('users:online', 0, true);
socket.emit('user.getOnlineAnonCount', {} , function(err, anonCount) {
if(parseInt(anonCount, 10) > 0) {
@@ -100,8 +98,11 @@ define(function() {
var html = templates.prepare(templates['users'].blocks['users']).parse({
users: users
});
if(emptyContainer)
if(emptyContainer) {
$('#users-container .registered-user').remove();
}
$('#users-container').append(html);
$('#users-container .anon-user').appendTo($('#users-container'));
}
@@ -125,6 +126,7 @@ define(function() {
function startLoading(set, after, emptyContainer) {
loadingMoreUsers = true;
socket.emit('user.loadMore', {
set: set,
after: after