hopefully I got everything right this time!!

v1.18.x
pichalite 9 years ago
parent 2723800628
commit 44d4c2bc7c

@ -549,7 +549,10 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll',
var username = components.get('chat/search').val(); var username = components.get('chat/search').val();
var chatsListEl = $('[component="chat/search/list"]'); var chatsListEl = $('[component="chat/search/list"]');
if(username) { if (!username) {
return chatsListEl.empty();
}
socket.emit('user.search', { socket.emit('user.search', {
query: username, query: username,
searchBy: 'username' searchBy: 'username'
@ -561,15 +564,14 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll',
chatsListEl.empty(); chatsListEl.empty();
if (data.users.length === 0) { if (data.users.length === 0) {
chatsListEl.append('<li><div><span>No users found!</span></div></li>'); chatsListEl.translateHtml('<li><div><span>[[users:no-users-found]]</span></div></li>');
} else { } else {
data.users.forEach(function(userObj) { data.users.forEach(function(userObj) {
function createUserImage() { function createUserImage() {
return (userObj.picture ? return (userObj.picture ?
'<img src="' + userObj.picture + '" title="' + userObj.username +'" />' : '<img src="' + userObj.picture + '" title="' + userObj.username +'" />' :
'<div class="user-icon" style="background-color: ' + userObj['icon:bgColor'] + '">' + userObj['icon:text'] + '</div>') + '<div class="user-icon" style="background-color: ' + userObj['icon:bgColor'] + '">' + userObj['icon:text'] + '</div>') +
'<i class="fa fa-circle status ' + userObj.status + '"></i> ' + '<i class="fa fa-circle status ' + userObj.status + '"></i> ' + userObj.username;
userObj.username;
} }
var chatEl = $('<li component="chat/search/user" />') var chatEl = $('<li component="chat/search/user" />')
@ -594,9 +596,6 @@ define('forum/chats', ['components', 'string', 'sounds', 'forum/infinitescroll',
} }
}); });
} else {
chatsListEl.empty();
}
} }
}; };
return Chats; return Chats;

Loading…
Cancel
Save