Commit 2e3cc12d authored by JC Brand's avatar JC Brand

Bugfix. Only remove modals when disconnected

not while tearing down, otherwise the modals get removed while
reconnecting and we have stale references to modals no longer in the
DOM.
parent 025cdbf1
...@@ -144,11 +144,8 @@ converse.plugins.add('converse-modal', { ...@@ -144,11 +144,8 @@ converse.plugins.add('converse-modal', {
/************************ BEGIN Event Listeners ************************/ /************************ BEGIN Event Listeners ************************/
_converse.api.listen.on('afterTearDown', () => { _converse.api.listen.on('disconnect', () => {
if (!_converse.chatboxviews) { const container = document.querySelector("#converse-modals");
return;
}
const container = _converse.chatboxviews.el.querySelector("#converse-modals");
if (container) { if (container) {
container.innerHTML = ''; container.innerHTML = '';
} }
......
...@@ -1239,7 +1239,7 @@ converse.plugins.add('converse-chat', { ...@@ -1239,7 +1239,7 @@ converse.plugins.add('converse-chat', {
/************************ BEGIN Event Handlers ************************/ /************************ BEGIN Event Handlers ************************/
_converse.api.listen.on('chatBoxesFetched', autoJoinChats); _converse.api.listen.on('chatBoxesFetched', autoJoinChats);
_converse.api.listen.on('presencesInitialized', () => registerMessageHandlers()); _converse.api.listen.on('presencesInitialized', registerMessageHandlers);
_converse.api.listen.on('clearSession', () => { _converse.api.listen.on('clearSession', () => {
if (_converse.shouldClearCache()) { if (_converse.shouldClearCache()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment