diff --git a/public/src/forum/footer.js b/public/src/forum/footer.js index f3d40432f9..f4049ba784 100644 --- a/public/src/forum/footer.js +++ b/public/src/forum/footer.js @@ -132,7 +132,20 @@ socket.emit('api:notifications.hasFlag'); - + socket.on('chatMessage', function(data) { + + var username = data.username; + var fromuid = data.fromuid; + var message = data.message; + + require(['chat'], function(chat) { + var chatModal = chat.createModalIfDoesntExist(username, fromuid); + chatModal.show(); + chat.bringModalToTop(chatModal); + + chat.appendChatMessage(chatModal, message); + }); + }); require(['mobileMenu'], function(mobileMenu) { diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index c4f550423c..bfbef594cf 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -261,22 +261,6 @@ }); - socket.on('chatMessage', function(data) { - - var username = data.username; - var fromuid = data.fromuid; - var message = data.message; - - require(['chat'], function(chat) { - var chatModal = chat.createModalIfDoesntExist(username, fromuid); - chatModal.show(); - chat.bringModalToTop(chatModal); - - chat.appendChatMessage(chatModal, message); - }); - }); - - ajaxify.register_events([ 'event:rep_up', 'event:rep_down', 'event:new_post', 'api:get_users_in_room', 'event:topic_deleted', 'event:topic_restored', 'event:topic:locked',