mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-02 05:40:43 +01:00
fix: #7167, composer and chat not closing on logout
This commit is contained in:
@@ -258,6 +258,12 @@ define('chat', [
|
||||
}
|
||||
};
|
||||
|
||||
// TODO: see taskbar.js:44
|
||||
module.closeByUUID = function (uuid) {
|
||||
var chatModal = $('.chat-modal[data-uuid="' + uuid + '"]');
|
||||
module.close(chatModal);
|
||||
};
|
||||
|
||||
module.center = function (chatModal) {
|
||||
var hideAfter = false;
|
||||
if (chatModal.hasClass('hide')) {
|
||||
|
||||
@@ -34,6 +34,42 @@ define('taskbar', ['benchpress', 'translator'], function (Benchpress, translator
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
$(window).on('action:app.loggedOut', function () {
|
||||
taskbar.closeAll();
|
||||
});
|
||||
};
|
||||
|
||||
taskbar.close = function (module, uuid) {
|
||||
// Sends signal to the appropriate module's .close() fn (if present)
|
||||
var btnEl = taskbar.tasklist.find('[data-module="' + module + '"][data-uuid="' + uuid + '"]');
|
||||
var fnName = 'close';
|
||||
|
||||
// TODO: Refactor chat module to not take uuid in close instead of by jQuery element
|
||||
if (module === 'chat') {
|
||||
fnName = 'closeByUUID';
|
||||
}
|
||||
|
||||
if (btnEl.length) {
|
||||
require([module], function (module) {
|
||||
if (typeof module[fnName] === 'function') {
|
||||
module[fnName](uuid);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
taskbar.closeAll = function (module) {
|
||||
// module is optional
|
||||
var selector = '[data-uuid]';
|
||||
|
||||
if (module) {
|
||||
selector = '[data-module="' + module + '"]' + selector;
|
||||
}
|
||||
|
||||
taskbar.tasklist.find(selector).each(function (idx, el) {
|
||||
taskbar.close(module || el.getAttribute('data-module'), el.getAttribute('data-uuid'));
|
||||
});
|
||||
};
|
||||
|
||||
taskbar.discard = function (module, uuid) {
|
||||
|
||||
Reference in New Issue
Block a user