feat: new client-side hooks for chat minimize and close

closes #7805
This commit is contained in:
Julian Lam
2019-08-06 11:04:45 -04:00
parent f2e4664d93
commit 3d3fa8655d

View File

@@ -125,6 +125,9 @@ define('chat', [
var modal = module.getModal(data.roomId); var modal = module.getModal(data.roomId);
modal.find('[component="chat/room/name"]').text(newTitle); modal.find('[component="chat/room/name"]').text(newTitle);
taskbar.updateTitle('chat', modal.attr('data-uuid'), newTitle); taskbar.updateTitle('chat', modal.attr('data-uuid'), newTitle);
$(window).trigger('action:chat.renamed', Object.assign(data, {
modal: modal,
}));
}; };
module.getModal = function (roomId) { module.getModal = function (roomId) {
@@ -262,15 +265,21 @@ define('chat', [
}; };
module.close = function (chatModal) { module.close = function (chatModal) {
var uuid = chatModal.attr('data-uuid');
clearInterval(chatModal.attr('intervalId')); clearInterval(chatModal.attr('intervalId'));
chatModal.attr('intervalId', 0); chatModal.attr('intervalId', 0);
chatModal.remove(); chatModal.remove();
chatModal.data('modal', null); chatModal.data('modal', null);
taskbar.discard('chat', chatModal.attr('data-uuid')); taskbar.discard('chat', uuid);
if (chatModal.attr('data-mobile')) { if (chatModal.attr('data-mobile')) {
module.disableMobileBehaviour(chatModal); module.disableMobileBehaviour(chatModal);
} }
$(window).trigger('action:chat.closed', {
uuid: uuid,
modal: chatModal,
});
}; };
// TODO: see taskbar.js:44 // TODO: see taskbar.js:44
@@ -344,6 +353,10 @@ define('chat', [
taskbar.minimize('chat', uuid); taskbar.minimize('chat', uuid);
clearInterval(chatModal.attr('intervalId')); clearInterval(chatModal.attr('intervalId'));
chatModal.attr('intervalId', 0); chatModal.attr('intervalId', 0);
$(window).trigger('action:chat.minimized', {
uuid: uuid,
modal: chatModal,
});
}; };
module.toggleNew = taskbar.toggleNew; module.toggleNew = taskbar.toggleNew;