Skip to content
Snippets Groups Projects
Commit 0586097a authored by std-odoo's avatar std-odoo
Browse files

[FIX] website_jitsi: do not update participant count when leaving


Purpose
=======
There's one special case for the participant count update.

When we leave a room, if we are the last participant, we directly
update the participant count without waiting for the cool down (because
the participant might change the page and so the JS might not be loaded
anymore).

But, Jitsi made a change and now, when we hanging up the room, when
the event "videoConferenceLeft" is called, we are the only participant
in the list even if they're still other people in the room. So every
time someone hanging up the room, he will send the "zero participant"
update.

As we can not properly fix it (and be sure it will be "future proof"),
we dropped this update.

So now, some empty rooms might be marked as having one participant,
but no room will be marked as having zero participant if they are not
empty (and we prefer this behavior than the opposite).

Task-2350117

closes odoo/odoo#59378

X-original-commit: 84575078b80a7bf865ed52d1682548af3346ec14
Signed-off-by: default avatarThibault Delavallee (tde) <tde@openerp.com>
parent 91bd2b8c
No related branches found
No related tags found
No related merge requests found
......@@ -90,16 +90,7 @@ publicWidget.registry.ChatRoom = publicWidget.Widget.extend({
$parentNode.find("iframe").trigger("empty");
$parentNode.empty();
let jitsiRoom = await this._joinJitsiRoom($parentNode);
$(jitsiRoom._frame).on("empty", async () => {
// we opened an other Jitsi room on the same parent node
await this._updatePartitipantCountIfEmpty();
});
jitsiRoom.addEventListener('videoConferenceLeft', async () => {
await this._updatePartitipantCountIfEmpty();
});
await this._joinJitsiRoom($parentNode);
} else {
// create a model and append the Jitsi iframe in it
let $jitsiModal = $(QWeb.render('chat_room_modal', {}));
......@@ -117,7 +108,6 @@ publicWidget.registry.ChatRoom = publicWidget.Widget.extend({
$jitsiModal.on('hidden.bs.modal', async () => {
jitsiRoom.dispose();
$(".o_wjitsi_room_modal").remove();
await this._updatePartitipantCountIfEmpty();
});
}
},
......@@ -202,19 +192,6 @@ publicWidget.registry.ChatRoom = publicWidget.Widget.extend({
return jitsiRoom;
},
/**
* If we are the last participant in the room, we are the only one who can send the
* "zero participant" update to the server.
*
* @private
*/
_updatePartitipantCountIfEmpty: async function () {
if (this.allParticipantIds && this.allParticipantIds.length === 1 && this.allParticipantIds[0] === this.participantId) {
// we are the last participant in the room and we left it
await this._updateParticipantCount(0, false);
}
},
/**
* Perform an HTTP request to update the participant count on the server side.
*
......
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