Skip to content
Snippets Groups Projects
Commit afbaae04 authored by ubermanu's avatar ubermanu
Browse files

move the userRooms promise resolution after we are connected

parent 7f1f9ab4
No related branches found
No related tags found
2 merge requests!124Wait for RAI sub promise when connected,!123Wait for RAI sub promise when connected
...@@ -7,7 +7,8 @@ converse.plugins.add('sib-subscribe-to-rai', { ...@@ -7,7 +7,8 @@ converse.plugins.add('sib-subscribe-to-rai', {
dependencies: [ dependencies: [
'converse-rai', 'converse-rai',
], ],
async initialize() { initialize() {
const { log } = converse.env;
const _converse = this._converse; const _converse = this._converse;
const { api } = _converse; const { api } = _converse;
...@@ -51,13 +52,15 @@ converse.plugins.add('sib-subscribe-to-rai', { ...@@ -51,13 +52,15 @@ converse.plugins.add('sib-subscribe-to-rai', {
}, 250); }, 250);
}); });
// @MattJ Here userRooms is an array of each jabberID the user is on.
let userRooms = (await Promise.all([
getCircles,
getProjects,
])).flat();
api.listen.on('connected', async () => { api.listen.on('connected', async () => {
// @MattJ Here userRooms is an array of each jabberID the user is on.
let userRooms = (await Promise.all([
getCircles,
getProjects,
])).flat();
log.info(`User rooms: ${userRooms.join(', ')}`);
await api.rooms.subscribe(userRooms); await api.rooms.subscribe(userRooms);
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment