1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2026-01-03 21:42:32 +03:00

Use random widget IDs for video rooms (#8739)

This commit is contained in:
Robin
2022-06-02 09:10:22 -04:00
committed by GitHub
parent abfc66a34e
commit f152310c08
6 changed files with 15 additions and 17 deletions

View File

@@ -32,7 +32,7 @@ import {
mkVideoChannelMember,
} from "../../test-utils";
import { MatrixClientPeg } from "../../../src/MatrixClientPeg";
import { VIDEO_CHANNEL, VIDEO_CHANNEL_MEMBER } from "../../../src/utils/VideoChannelUtils";
import { VIDEO_CHANNEL_MEMBER } from "../../../src/utils/VideoChannelUtils";
import WidgetStore from "../../../src/stores/WidgetStore";
import _VideoRoomView from "../../../src/components/structures/VideoRoomView";
import VideoLobby from "../../../src/components/views/voip/VideoLobby";
@@ -42,7 +42,7 @@ const VideoRoomView = wrapInMatrixClientContext(_VideoRoomView);
describe("VideoRoomView", () => {
jest.spyOn(WidgetStore.instance, "getApps").mockReturnValue([{
id: VIDEO_CHANNEL,
id: "1",
eventId: "$1:example.org",
roomId: "!1:example.org",
type: MatrixWidgetType.JitsiMeet,
@@ -50,6 +50,7 @@ describe("VideoRoomView", () => {
name: "Video channel",
creatorUserId: "@alice:example.org",
avatar_url: null,
data: { isVideoChannel: true },
}]);
Object.defineProperty(navigator, "mediaDevices", {
value: { enumerateDevices: () => [] },

View File

@@ -23,7 +23,7 @@ import { stubClient, setupAsyncStoreWithClient } from "./test-utils";
import { MatrixClientPeg } from "../src/MatrixClientPeg";
import WidgetStore from "../src/stores/WidgetStore";
import WidgetUtils from "../src/utils/WidgetUtils";
import { VIDEO_CHANNEL, VIDEO_CHANNEL_MEMBER } from "../src/utils/VideoChannelUtils";
import { VIDEO_CHANNEL_MEMBER } from "../src/utils/VideoChannelUtils";
import createRoom, { canEncryptToAllUsers } from '../src/createRoom';
describe("createRoom", () => {
@@ -43,12 +43,11 @@ describe("createRoom", () => {
events: { [VIDEO_CHANNEL_MEMBER]: videoMemberPower },
},
}]] = mocked(client.createRoom).mock.calls as any; // no good type
const [[widgetRoomId, widgetStateKey, , widgetId]] = mocked(client.sendStateEvent).mock.calls;
const [[widgetRoomId, widgetStateKey]] = mocked(client.sendStateEvent).mock.calls;
// We should have set up the Jitsi widget
expect(widgetRoomId).toEqual(roomId);
expect(widgetStateKey).toEqual("im.vector.modular.widgets");
expect(widgetId).toEqual(VIDEO_CHANNEL);
// All members should be able to update their connected devices
expect(videoMemberPower).toEqual(0);

View File

@@ -23,14 +23,13 @@ import WidgetStore, { IApp } from "../../src/stores/WidgetStore";
import { WidgetMessagingStore } from "../../src/stores/widgets/WidgetMessagingStore";
import { ElementWidgetActions } from "../../src/stores/widgets/ElementWidgetActions";
import VideoChannelStore, { VideoChannelEvent } from "../../src/stores/VideoChannelStore";
import { VIDEO_CHANNEL } from "../../src/utils/VideoChannelUtils";
describe("VideoChannelStore", () => {
const store = VideoChannelStore.instance;
const widget = { id: VIDEO_CHANNEL } as unknown as Widget;
const widget = { id: "1" } as unknown as Widget;
const app = {
id: VIDEO_CHANNEL,
id: "1",
eventId: "$1:example.org",
roomId: "!1:example.org",
type: MatrixWidgetType.JitsiMeet,
@@ -38,6 +37,7 @@ describe("VideoChannelStore", () => {
name: "Video channel",
creatorUserId: "@alice:example.org",
avatar_url: null,
data: { isVideoChannel: true },
} as IApp;
// Set up mocks to simulate the remote end of the widget API