From 022f38f8e3d9b86905ac9b88df9475f7804fc5a1 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Fri, 10 Apr 2020 16:15:52 +0200 Subject: [PATCH] Reopen conversation on page reload --- assets/js/components/calls/controller.js | 2 +- assets/js/components/calls/window.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/assets/js/components/calls/controller.js b/assets/js/components/calls/controller.js index 827de2ee..54fa8d44 100644 --- a/assets/js/components/calls/controller.js +++ b/assets/js/components/calls/controller.js @@ -80,7 +80,7 @@ document.addEventListener("wsClosed", () => { // Close all the current conversations OpenConversations.forEach((v) => v.Close(false)) - OpenConversations = new Map(); + OpenConversations.clear(); }) diff --git a/assets/js/components/calls/window.js b/assets/js/components/calls/window.js index 974096ba..d3f9da01 100644 --- a/assets/js/components/calls/window.js +++ b/assets/js/components/calls/window.js @@ -148,9 +148,10 @@ class CallWindow extends CustomEvents { this.rootEl.remove(); // Leave the call - await ws("calls/leave", { - convID: this.conv.ID - }) + if(UserWebSocket.IsConnected) + await ws("calls/leave", { + convID: this.conv.ID + }) if(propagate) this.emitEvent("close");