From 70e9d9254db3a5e3626a65c14d34bb1d7ec35155 Mon Sep 17 00:00:00 2001 From: IceDBorn Date: Sat, 25 Mar 2023 21:30:11 +0200 Subject: [PATCH] Fix navigating outside of current space when a call is active --- src/app/organisms/room/JitsiRoom.jsx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/app/organisms/room/JitsiRoom.jsx b/src/app/organisms/room/JitsiRoom.jsx index 2a272b2f..5a12f484 100644 --- a/src/app/organisms/room/JitsiRoom.jsx +++ b/src/app/organisms/room/JitsiRoom.jsx @@ -29,13 +29,18 @@ function JitsiRoom({ isJitsiRoom, setIsJitsiRoom, jitsiCallId, setJitsiCallId }) useEffect(() => { const handleRoomSelected = (rId, pRoomId, eId) => { + let topic = ''; + let roomTimeline = null; roomInfo.roomTimeline?.removeInternalListeners(); - const roomTimeline = new RoomTimeline(rId); - const topic = roomTimeline.room.currentState - .getStateEvents('m.room.topic')[0] - ?.getContent().topic; - if (mx.getRoom(rId) && topic === TOPIC_JITSI_CALL && jitsiCallId !== rId) { + if (mx.getRoom(rId)) { + roomTimeline = new RoomTimeline(rId); + topic = roomTimeline.room?.currentState + .getStateEvents('m.room.topic')[0] + ?.getContent().topic; + } + + if (topic === TOPIC_JITSI_CALL && jitsiCallId !== rId) { setJitsiCallId(rId); setRoomName(roomTimeline.roomName); setRoomInfo({ @@ -93,7 +98,7 @@ function JitsiRoom({ isJitsiRoom, setIsJitsiRoom, jitsiCallId, setJitsiCallId })