From 9adfdb8feda720645920846dd4546a07ef181747 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 3 Feb 2022 11:31:32 +0000 Subject: [PATCH] Open native room when clicking notification from a virtual room (#7709) * Handle virtual rooms when showing a notification * This should be using sharedInstance() Co-authored-by: Andrew Morgan --- src/Notifier.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Notifier.ts b/src/Notifier.ts index 89153ef92c..f5eafba407 100644 --- a/src/Notifier.ts +++ b/src/Notifier.ts @@ -40,6 +40,8 @@ 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"; +import VoipUserMapper from "./VoipUserMapper"; /* * Dispatches: @@ -386,7 +388,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 = VoipUserMapper.sharedInstance().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 &&