mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-09 23:45:45 +01:00
closes #767
This commit is contained in:
@@ -7,6 +7,7 @@ define(['taskbar', 'string'], function(taskbar, S) {
|
|||||||
var chatsToggleEl = $('#chat_dropdown'),
|
var chatsToggleEl = $('#chat_dropdown'),
|
||||||
chatsListEl = $('#chat-list'),
|
chatsListEl = $('#chat-list'),
|
||||||
chatDropdownEl = chatsToggleEl.parent();
|
chatDropdownEl = chatsToggleEl.parent();
|
||||||
|
|
||||||
chatsToggleEl.on('click', function() {
|
chatsToggleEl.on('click', function() {
|
||||||
if (chatDropdownEl.hasClass('open')) {
|
if (chatDropdownEl.hasClass('open')) {
|
||||||
return;
|
return;
|
||||||
@@ -43,28 +44,30 @@ define(['taskbar', 'string'], function(taskbar, S) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
socket.on('event:chats.receive', function(data) {
|
socket.on('event:chats.receive', function(data) {
|
||||||
require(['chat'], function(chat) {
|
|
||||||
if (chat.modalExists(data.fromuid)) {
|
if (module.modalExists(data.fromuid)) {
|
||||||
var modal = chat.getModal(data.fromuid);
|
var modal = module.getModal(data.fromuid);
|
||||||
chat.appendChatMessage(modal, data.message, data.timestamp);
|
module.appendChatMessage(modal, data.message, data.timestamp);
|
||||||
|
|
||||||
if (modal.is(":visible")) {
|
if (modal.is(":visible")) {
|
||||||
chat.load(modal.attr('UUID'));
|
module.bringModalToTop(modal);
|
||||||
|
checkOnlineStatus(modal);
|
||||||
|
taskbar.updateActive(modal.attr('UUID'));
|
||||||
|
scrollToBottom(modal.find('#chat-content'));
|
||||||
} else {
|
} else {
|
||||||
chat.toggleNew(modal.attr('UUID'), true);
|
module.toggleNew(modal.attr('UUID'), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!modal.is(":visible") || !app.isFocused) {
|
if (!modal.is(":visible") || !app.isFocused) {
|
||||||
app.alternatingTitle(data.username + ' has messaged you');
|
app.alternatingTitle(data.username + ' has messaged you');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
chat.createModal(data.username, data.fromuid, function(modal) {
|
module.createModal(data.username, data.fromuid, function(modal) {
|
||||||
chat.toggleNew(modal.attr('UUID'), true);
|
module.toggleNew(modal.attr('UUID'), true);
|
||||||
app.alternatingTitle(data.username + ' has messaged you');
|
app.alternatingTitle(data.username + ' has messaged you');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.bringModalToTop = function(chatModal) {
|
module.bringModalToTop = function(chatModal) {
|
||||||
|
|||||||
Reference in New Issue
Block a user