|
|
@ -29,7 +29,6 @@ define('forum/chats', [
|
|
|
|
|
|
|
|
|
|
|
|
let newMessage = false;
|
|
|
|
let newMessage = false;
|
|
|
|
let chatNavWrapper = null;
|
|
|
|
let chatNavWrapper = null;
|
|
|
|
let userListEl = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(window).on('action:ajaxify.start', function () {
|
|
|
|
$(window).on('action:ajaxify.start', function () {
|
|
|
|
Chats.destroyAutoComplete(ajaxify.data.roomId);
|
|
|
|
Chats.destroyAutoComplete(ajaxify.data.roomId);
|
|
|
@ -48,7 +47,6 @@ define('forum/chats', [
|
|
|
|
socket.emit('modules.chats.enterPublic', ajaxify.data.publicRooms.map(r => r.roomId));
|
|
|
|
socket.emit('modules.chats.enterPublic', ajaxify.data.publicRooms.map(r => r.roomId));
|
|
|
|
const env = utils.findBootstrapEnvironment();
|
|
|
|
const env = utils.findBootstrapEnvironment();
|
|
|
|
chatNavWrapper = $('[component="chat/nav-wrapper"]');
|
|
|
|
chatNavWrapper = $('[component="chat/nav-wrapper"]');
|
|
|
|
userListEl = $('[component="chat/user/list"]');
|
|
|
|
|
|
|
|
if (!Chats.initialised) {
|
|
|
|
if (!Chats.initialised) {
|
|
|
|
Chats.addSocketListeners();
|
|
|
|
Chats.addSocketListeners();
|
|
|
|
Chats.addGlobalEventListeners();
|
|
|
|
Chats.addGlobalEventListeners();
|
|
|
@ -469,7 +467,6 @@ define('forum/chats', [
|
|
|
|
const mainWrapper = components.get('chat/main-wrapper');
|
|
|
|
const mainWrapper = components.get('chat/main-wrapper');
|
|
|
|
mainWrapper.html(html);
|
|
|
|
mainWrapper.html(html);
|
|
|
|
chatNavWrapper = $('[component="chat/nav-wrapper"]');
|
|
|
|
chatNavWrapper = $('[component="chat/nav-wrapper"]');
|
|
|
|
userListEl = $('[component="chat/user/list"]');
|
|
|
|
|
|
|
|
html.find('.timeago').timeago();
|
|
|
|
html.find('.timeago').timeago();
|
|
|
|
ajaxify.data = { ...ajaxify.data, ...payload, roomId: roomId };
|
|
|
|
ajaxify.data = { ...ajaxify.data, ...payload, roomId: roomId };
|
|
|
|
ajaxify.updateTitle(ajaxify.data.title);
|
|
|
|
ajaxify.updateTitle(ajaxify.data.title);
|
|
|
@ -528,10 +525,6 @@ define('forum/chats', [
|
|
|
|
Chats.increasePublicRoomUnreadCount(chatNavWrapper.find('[data-roomid=' + data.roomId + ']'));
|
|
|
|
Chats.increasePublicRoomUnreadCount(chatNavWrapper.find('[data-roomid=' + data.roomId + ']'));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
socket.on('event:chats.user-online', function (data) {
|
|
|
|
|
|
|
|
userListEl.find(`[data-uid="${data.uid}"]`).toggleClass('online', !!data.state);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
socket.on('event:user_status_change', function (data) {
|
|
|
|
socket.on('event:user_status_change', function (data) {
|
|
|
|
app.updateUserStatus($('.chats-list [data-uid="' + data.uid + '"] [component="user/status"]'), data.status);
|
|
|
|
app.updateUserStatus($('.chats-list [data-uid="' + data.uid + '"] [component="user/status"]'), data.status);
|
|
|
|
});
|
|
|
|
});
|
|
|
|