Step 8.4.1: Use `RoomViewStore` in SGWidgetDriver over `ActiveRoomObserver`

It wasn't using the listener functionality anyways, so just go straight to the source for which room is being viewed.
pull/21833/head
Travis Ralston 2022-03-08 15:29:41 -07:00
parent d5ed1eb66e
commit 109ecbf070
1 changed files with 3 additions and 3 deletions

View File

@ -37,7 +37,6 @@ import { THREAD_RELATION_TYPE } from "matrix-js-sdk/src/models/thread";
import { iterableDiff, iterableIntersection } from "../../utils/iterables";
import { MatrixClientPeg } from "../../MatrixClientPeg";
import ActiveRoomObserver from "../../ActiveRoomObserver";
import Modal from "../../Modal";
import WidgetOpenIDPermissionsDialog from "../../components/views/dialogs/WidgetOpenIDPermissionsDialog";
import WidgetCapabilitiesPromptDialog from "../../components/views/dialogs/WidgetCapabilitiesPromptDialog";
@ -49,6 +48,7 @@ import { containsEmoji } from "../../effects/utils";
import dis from "../../dispatcher/dispatcher";
import { tryTransformPermalinkToLocalHref } from "../../utils/permalinks/Permalinks";
import SettingsStore from "../../settings/SettingsStore";
import { RoomViewStore } from "../RoomViewStore";
// TODO: Purge this from the universe
@ -150,7 +150,7 @@ export class StopGapWidgetDriver extends WidgetDriver {
targetRoomId: string = null,
): Promise<ISendEventDetails> {
const client = MatrixClientPeg.get();
const roomId = targetRoomId || ActiveRoomObserver.activeRoomId;
const roomId = targetRoomId || RoomViewStore.instance.getRoomId();
if (!client || !roomId) throw new Error("Not in a room or not attached to a client");
@ -188,7 +188,7 @@ export class StopGapWidgetDriver extends WidgetDriver {
const targetRooms = roomIds
? (roomIds.includes(Symbols.AnyRoom) ? client.getVisibleRooms() : roomIds.map(r => client.getRoom(r)))
: [client.getRoom(ActiveRoomObserver.activeRoomId)];
: [client.getRoom(RoomViewStore.instance.getRoomId())];
return targetRooms.filter(r => !!r);
}