From ee1f3dc502185cd4b224a6cd8ab7d97927edbfe2 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Tue, 24 Aug 2021 03:36:14 +0100 Subject: [PATCH 1/2] Handle virtual rooms when showing a notification --- src/Notifier.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Notifier.ts b/src/Notifier.ts index 89153ef92c1..f1c2ef1d317 100644 --- a/src/Notifier.ts +++ b/src/Notifier.ts @@ -40,6 +40,7 @@ import RoomViewStore from "./stores/RoomViewStore"; import UserActivity from "./UserActivity"; import { mediaFromMxc } from "./customisations/Media"; import ErrorDialog from "./components/views/dialogs/ErrorDialog"; +import CallHandler from "./CallHandler"; /* * Dispatches: @@ -386,7 +387,16 @@ export const Notifier = { }, _evaluateEvent: function(ev: MatrixEvent) { - const room = MatrixClientPeg.get().getRoom(ev.getRoomId()); + let roomId = ev.getRoomId(); + if (CallHandler.instance.getSupportsVirtualRooms()) { + // Attempt to translate a virtual room to a native one + const nativeRoomId = window.mxVoipUserMapper.nativeRoomForVirtualRoom(roomId); + if (nativeRoomId) { + roomId = nativeRoomId; + } + } + const room = MatrixClientPeg.get().getRoom(roomId); + const actions = MatrixClientPeg.get().getPushActionsForEvent(ev); if (actions?.notify) { if (RoomViewStore.getRoomId() === room.roomId && From 9bb55160b4a4e737bd22db8c5a8267220e3c548f Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 3 Feb 2022 09:32:17 +0000 Subject: [PATCH 2/2] This should be using sharedInstance() --- src/Notifier.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Notifier.ts b/src/Notifier.ts index f1c2ef1d317..f5eafba407c 100644 --- a/src/Notifier.ts +++ b/src/Notifier.ts @@ -41,6 +41,7 @@ import UserActivity from "./UserActivity"; import { mediaFromMxc } from "./customisations/Media"; import ErrorDialog from "./components/views/dialogs/ErrorDialog"; import CallHandler from "./CallHandler"; +import VoipUserMapper from "./VoipUserMapper"; /* * Dispatches: @@ -390,7 +391,7 @@ export const Notifier = { let roomId = ev.getRoomId(); if (CallHandler.instance.getSupportsVirtualRooms()) { // Attempt to translate a virtual room to a native one - const nativeRoomId = window.mxVoipUserMapper.nativeRoomForVirtualRoom(roomId); + const nativeRoomId = VoipUserMapper.sharedInstance().nativeRoomForVirtualRoom(roomId); if (nativeRoomId) { roomId = nativeRoomId; }