|
|
@ -152,8 +152,7 @@ define('chat', ['components', 'taskbar', 'string', 'sounds', 'forum/chats', 'tra
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for(var x = 0; x<chats.length; ++x) {
|
|
|
|
chats.forEach(function(userObj) {
|
|
|
|
userObj = chats[x];
|
|
|
|
|
|
|
|
dropdownEl = $('<li class="' + (userObj.unread ? 'unread' : '') + '"/>')
|
|
|
|
dropdownEl = $('<li class="' + (userObj.unread ? 'unread' : '') + '"/>')
|
|
|
|
.attr('data-uid', userObj.uid)
|
|
|
|
.attr('data-uid', userObj.uid)
|
|
|
|
.html('<a data-ajaxify="false">'+
|
|
|
|
.html('<a data-ajaxify="false">'+
|
|
|
@ -162,16 +161,15 @@ define('chat', ['components', 'taskbar', 'string', 'sounds', 'forum/chats', 'tra
|
|
|
|
userObj.username + '</a>')
|
|
|
|
userObj.username + '</a>')
|
|
|
|
.appendTo(chatsListEl);
|
|
|
|
.appendTo(chatsListEl);
|
|
|
|
|
|
|
|
|
|
|
|
(function(userObj) {
|
|
|
|
|
|
|
|
dropdownEl.click(function() {
|
|
|
|
dropdownEl.click(function() {
|
|
|
|
if (!ajaxify.currentPage.match(/^chats\//)) {
|
|
|
|
if (!ajaxify.currentPage.match(/^chats\//)) {
|
|
|
|
app.openChat(userObj.username, userObj.uid);
|
|
|
|
app.openChat(userObj.username, userObj.uid);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
ajaxify.go('chats/' + utils.slugify(userObj.username));
|
|
|
|
ajaxify.go('chats/' + utils.slugify(userObj.username));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
})(userObj);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -490,8 +488,11 @@ define('chat', ['components', 'taskbar', 'string', 'sounds', 'forum/chats', 'tra
|
|
|
|
|
|
|
|
|
|
|
|
module.sync = function() {
|
|
|
|
module.sync = function() {
|
|
|
|
socket.emit('modules.chats.sync', function(err, users) {
|
|
|
|
socket.emit('modules.chats.sync', function(err, users) {
|
|
|
|
for(var x=0,numUsers=users.length,user;x<numUsers;x++) {
|
|
|
|
if (err) {
|
|
|
|
user = users[x];
|
|
|
|
return app.alertError(err.message);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
users.forEach(function(user) {
|
|
|
|
if (!module.modalExists(user.uid)) {
|
|
|
|
if (!module.modalExists(user.uid)) {
|
|
|
|
module.createModal({
|
|
|
|
module.createModal({
|
|
|
|
username: user.username,
|
|
|
|
username: user.username,
|
|
|
@ -503,7 +504,7 @@ define('chat', ['components', 'taskbar', 'string', 'sounds', 'forum/chats', 'tra
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|