Commit f2d35bf6 authored by Jean-Baptiste Pasquier's avatar Jean-Baptiste Pasquier

update: handle one chat at a time

parent 950ab2c0
Pipeline #5657 passed with stage
in 28 seconds
......@@ -120,11 +120,23 @@ export const SibChat = {
if (converse_el) {
root.appendChild(converse_el);
}
if(this._converse.auto_join_rooms[0]) {
if(this._converse.chatboxviews.get(this._converse.auto_join_rooms[0])) {
this._converse.chatboxviews.get(this._converse.auto_join_rooms[0]).close();
}
}
if(this._converse.auto_join_private_chats[0]) {
if(this._converse.chatboxviews.get(this._converse.auto_join_private_chats[0])) {
this._converse.chatboxviews.get(this._converse.auto_join_private_chats[0]).close();
}
}
if (is_groupchat) {
this._converse.auto_join_rooms.push(jid);
this._converse.auto_join_private_chats = [];
this._converse.auto_join_rooms = [jid];
this._converse.api.rooms.open(jid);
} else {
this._converse.auto_join_private_chats.push(jid);
this._converse.auto_join_rooms = [];
this._converse.auto_join_private_chats = [jid];
this._converse.api.chats.open(jid);
}
}
......@@ -133,11 +145,11 @@ export const SibChat = {
converse.plugins.add('conversejs-changechat', converse_sib.service.plugins.sibChat);
// Initialize deferred resolution plugin
converse.plugins.add('conversejs-sib', {
converse.plugins.add('conversejs-sib-connected', {
initialize() {
this._converse.api.listen.on('connected', converse_sib.connected_deferred.resolve);
}
})
});
let user = await document.querySelector('sib-auth').getUser();
user = await store.get(user);
......@@ -196,7 +208,7 @@ export const SibChat = {
fileupload: false,
toggle_occupants: false
},
'whitelisted_plugins': ['conversejs-sib', 'conversejs-changechat'],
'whitelisted_plugins': ['conversejs-sib-connected', 'conversejs-changechat'],
});
converse_sib.loaded_deferred.resolve();
......
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