From 7435f1101acf04b68a55d15e713422272ec46202 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 23 Sep 2022 15:35:05 +0100 Subject: [PATCH 1/2] Fix bug causing mic/webcam to remain open after call Fixes https://github.com/vector-im/element-call/issues/596 --- src/room/GroupCallView.tsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/room/GroupCallView.tsx b/src/room/GroupCallView.tsx index c8ddf96..36f3703 100644 --- a/src/room/GroupCallView.tsx +++ b/src/room/GroupCallView.tsx @@ -132,18 +132,17 @@ export function GroupCallView({ const history = useHistory(); const onLeave = useCallback(() => { + setLeft(true); leave(); if (widget) { widget.api.transport.send(ElementWidgetActions.HangupCall, {}); widget.api.setAlwaysOnScreen(false); } - if (isPasswordlessUser) { - setLeft(true); - } else if (!isEmbedded) { + if (!isEmbedded) { history.push("/"); } - }, [leave, isPasswordlessUser, isEmbedded, history]); + }, [leave, isEmbedded, history]); useEffect(() => { if (widget && state === GroupCallState.Entered) { @@ -208,7 +207,14 @@ export function GroupCallView({ ); } else if (left) { - return ; + if (isPasswordlessUser) { + return ; + } else { + // If the user is a regular user, we'll have sent them back to the homepage, + // so just sit here & do nothing: otherwise we would (briefly) mount the + // LobbyView again which would open capture devices again. + return null; + } } else if (preload) { return null; } else if (isEmbedded) { From ded6a80b5873e52d00895f74ef6041bcfbd75bbb Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 23 Sep 2022 15:38:35 +0100 Subject: [PATCH 2/2] Fix passworldess user prompt screen This is how boolean logic works --- src/room/GroupCallView.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/room/GroupCallView.tsx b/src/room/GroupCallView.tsx index 36f3703..0ee6cfb 100644 --- a/src/room/GroupCallView.tsx +++ b/src/room/GroupCallView.tsx @@ -139,10 +139,10 @@ export function GroupCallView({ widget.api.setAlwaysOnScreen(false); } - if (!isEmbedded) { + if (!isPasswordlessUser && !isEmbedded) { history.push("/"); } - }, [leave, isEmbedded, history]); + }, [leave, isPasswordlessUser, isEmbedded, history]); useEffect(() => { if (widget && state === GroupCallState.Entered) {