mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 02:16:29 +02:00
fix: chats, allow multiple dropdowns like in harmony
This commit is contained in:
@@ -482,7 +482,7 @@ define('forum/chats', [
|
||||
newMessage = data.self === 0;
|
||||
}
|
||||
data.message.self = data.self;
|
||||
data.message.timestamp = Math.min(Date.now(), data.message.timetamp);
|
||||
data.message.timestamp = Math.min(Date.now(), data.message.timestamp);
|
||||
data.message.timestampISO = utils.toISOString(data.message.timestamp);
|
||||
messages.appendChatMessage($('.expanded-chat .chat-content'), data.message);
|
||||
} else if (ajaxify.data.template.chats) {
|
||||
|
||||
@@ -4,20 +4,21 @@ define('forum/header/chat', ['components', 'hooks'], function (components, hooks
|
||||
const chat = {};
|
||||
|
||||
chat.prepareDOM = function () {
|
||||
const chatsListEl = components.get('chat/list');
|
||||
|
||||
const chatsToggleEl = $('[component="chat/dropdown"]');
|
||||
if (!chatsToggleEl) {
|
||||
if (!chatsToggleEl.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
chatsToggleEl.on('show.bs.dropdown', () => {
|
||||
requireAndCall('loadChatsDropdown', chatsListEl);
|
||||
chatsToggleEl.on('show.bs.dropdown', (ev) => {
|
||||
requireAndCall('loadChatsDropdown', $(ev.target).parent().find('[component="chat/list"]'));
|
||||
});
|
||||
|
||||
if (chatsToggleEl.parents('.dropdown').hasClass('show')) {
|
||||
requireAndCall('loadChatsDropdown', chatsListEl);
|
||||
}
|
||||
chatsToggleEl.each((index, el) => {
|
||||
const dropdownEl = $(el).parent().find('.dropdown-menu');
|
||||
if (dropdownEl.hasClass('show')) {
|
||||
requireAndCall('loadChatsDropdown', dropdownEl.find('[component="chat/list"]'));
|
||||
}
|
||||
});
|
||||
|
||||
socket.removeListener('event:chats.receive', onChatMessageReceived);
|
||||
socket.on('event:chats.receive', onChatMessageReceived);
|
||||
|
||||
Reference in New Issue
Block a user