users chats page
-
when you land in the users chat url
/user/username/chats
there are no chat opens by default, and you see a message
You have no active chats.
I want to change that, and if you land on that url, you get the latest chat open by default (this can be acchieved by opening the latest chat on that url, or redirecting to the latest chat url)
How can I get this done?
-
You could use the below custom javascript, it will open the last chat if there is no open chat.
$(window).on('action:ajaxify.end', async () => { const { data } = ajaxify; if (data.template.chats && !data.template.roomId && data.rooms.length) { const Chats = await app.require('forum/chats'); Chats.switchChat(data.rooms[0].roomId); } });
Copyright © 2024 NodeBB | Contributors