component="chat/nav-wrapper" not updated when new messages come in.
-
I see that this is working fine on https://community.nodebb.org/ , so I think something of my custom code is interfiering with the component update. I'm working on a child theme of persona theme. I've build this like 3 years ago, and constaly updating the website, but maybe something got old, not sure. I'm currently on nodebb 3.8.2
I'm working on template "chats", and my problem is that component="chat/nav-wrapper" (left sidebar with the list of chat rooms) is not beeing updated when new messages come in. The component="chat/main-wrapper" (main chat window) is owkring fine, new messages are shown as soon as the other users in the same chat room submit new messages.
I'm not sure where to look to fix this. Maybe If I see how this is done on the nodebb core files, or theme I can replicate, or try to debug better.
I can event add some custom js code that makes this feature back to work. I've been testing
socket.on('event:chats.receive', function (data) { console.log('------- event:chats.receive -------'); console.log(data); console.log('-----------------------------------'); }); $(window).on('action:chat.received', function(ev, data) { console.log('------- action:chat.received -------'); console.log(data); console.log('-----------------------------------'); });
But these console logs only gets fired when the user is in the same room. If the user is on a different room, and gets a message, these console log are not getting not fired. I'm trying to find the right hook, so maybe I can code the code to update the component="chat/nav-wrapper" when new messages come in.
-
This commit implements that, the teasers are updated in the event
event:unread.updateChatCount
because that is sent even if the user is not currently in that room.
https://github.com/NodeBB/NodeBB/commit/ac644ac2866bfa48a939a94b6ec34ad9fd493f7d