Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Open native room when clicking notification from a virtual room (#7709)
Browse files Browse the repository at this point in the history
* Handle virtual rooms when showing a notification

* This should be using sharedInstance()

Co-authored-by: Andrew Morgan <andrew@amorgan.xyz>
  • Loading branch information
dbkr and anoadragon453 authored Feb 3, 2022
1 parent 760d269 commit 9adfdb8
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Notifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 &&
Expand Down

0 comments on commit 9adfdb8

Please sign in to comment.