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 <andrew@amorgan.xyz>
pull/21833/head
David Baker 2022-02-03 11:31:32 +00:00 committed by GitHub
parent 760d269671
commit 9adfdb8fed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 1 deletions

View File

@ -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 &&