more fixes

v1.18.x
Baris Soner Usakli 11 years ago
parent b3816b98a1
commit b7f0c90bf7

@ -250,42 +250,22 @@ var socket,
var uids = [];
jQuery('.post-row').each(function () {
uids.push(this.getAttribute('data-uid'));
var uid = $(this).attr('data-uid');
if(uids.indexOf(uid) === -1) {
uids.push(uid);
}
});
socket.emit('user.getOnlineUsers', uids, function (err, users) {
jQuery('a.username-field').each(function () {
if (this.processed === true)
return;
var el = jQuery(this),
uid = el.parents('li').attr('data-uid');
if (uid && jQuery.inArray(uid, users) !== -1) {
el.find('i').remove();
el.prepend('<i class="fa fa-circle"></i>');
} else {
el.find('i').remove();
el.prepend('<i class="fa fa-circle-o"></i>');
}
el.processed = true;
});
jQuery('button .username-field').each(function () {
//DRY FAIL
if (this.processed === true)
return;
jQuery('button .username-field').each(function (index, element) {
var el = jQuery(this),
uid = el.parents('li').attr('data-uid');
if (uid && jQuery.inArray(uid, users) !== -1) {
el.parent().addClass('btn-success');
el.parent().addClass('btn-success').removeClass('btn-danger');
} else {
el.parent().addClass('btn-danger');
el.parent().addClass('btn-danger').removeClass('btn-success');
}
el.processed = true;
});
});
};

@ -1049,7 +1049,10 @@ define(['composer'], function(composer) {
.fadeIn('slow');
for (var x = 0, numPosts = data.posts.length; x < numPosts; x++) {
socket.emit('posts.getPrivileges', data.posts[x].pid, function(privileges) {
socket.emit('posts.getPrivileges', data.posts[x].pid, function(err, privileges) {
if(err) {
return app.alertError(err.message);
}
toggle_mod_tools(privileges.pid, privileges.editable);
});
}

Loading…
Cancel
Save