From 371ccd78580f6ecff3d74b526a602c84af2f4f0c Mon Sep 17 00:00:00 2001 From: Robin Date: Mon, 4 Apr 2022 10:29:40 -0400 Subject: [PATCH] Don't use m.call for Jitsi video rooms (#8223) --- src/components/structures/RoomView.tsx | 2 +- src/components/structures/SpaceRoomView.tsx | 2 +- src/components/views/context_menus/RoomContextMenu.tsx | 2 +- src/components/views/dialogs/CreateRoomDialog.tsx | 2 +- src/components/views/right_panel/RoomSummaryCard.tsx | 2 +- src/components/views/rooms/RoomList.tsx | 4 ++-- src/components/views/rooms/RoomListHeader.tsx | 4 ++-- src/components/views/rooms/RoomTile.tsx | 2 +- src/createRoom.ts | 4 ++-- test/components/views/rooms/RoomTile-test.tsx | 2 +- test/test-utils/test-utils.ts | 2 +- 11 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/components/structures/RoomView.tsx b/src/components/structures/RoomView.tsx index ab06369406..ca529b8adf 100644 --- a/src/components/structures/RoomView.tsx +++ b/src/components/structures/RoomView.tsx @@ -375,7 +375,7 @@ export class RoomView extends React.Component { }; private getMainSplitContentType = (room: Room) => { - if (SettingsStore.getValue("feature_video_rooms") && room.isCallRoom()) { + if (SettingsStore.getValue("feature_video_rooms") && room.isElementVideoRoom()) { return MainSplitContentType.Video; } if (WidgetLayoutStore.instance.hasMaximisedWidget(room)) { diff --git a/src/components/structures/SpaceRoomView.tsx b/src/components/structures/SpaceRoomView.tsx index f6f8ae3f47..aaf3e4e135 100644 --- a/src/components/structures/SpaceRoomView.tsx +++ b/src/components/structures/SpaceRoomView.tsx @@ -347,7 +347,7 @@ const SpaceLandingAddButton = ({ space }) => { e.stopPropagation(); closeMenu(); - if (await showCreateNewRoom(space, RoomType.UnstableCall)) { + if (await showCreateNewRoom(space, RoomType.ElementVideo)) { defaultDispatcher.fire(Action.UpdateSpaceHierarchy); } }} diff --git a/src/components/views/context_menus/RoomContextMenu.tsx b/src/components/views/context_menus/RoomContextMenu.tsx index 35ecf97a9c..8a0f5a04c1 100644 --- a/src/components/views/context_menus/RoomContextMenu.tsx +++ b/src/components/views/context_menus/RoomContextMenu.tsx @@ -105,7 +105,7 @@ const RoomContextMenu = ({ room, onFinished, ...props }: IProps) => { } const isDm = DMRoomMap.shared().getUserIdForRoomId(room.roomId); - const isVideoRoom = useFeatureEnabled("feature_video_rooms") && room.isCallRoom(); + const isVideoRoom = useFeatureEnabled("feature_video_rooms") && room.isElementVideoRoom(); let inviteOption: JSX.Element; if (room.canInvite(cli.getUserId()) && !isDm) { diff --git a/src/components/views/dialogs/CreateRoomDialog.tsx b/src/components/views/dialogs/CreateRoomDialog.tsx index feec344313..ffb28719a7 100644 --- a/src/components/views/dialogs/CreateRoomDialog.tsx +++ b/src/components/views/dialogs/CreateRoomDialog.tsx @@ -221,7 +221,7 @@ export default class CreateRoomDialog extends React.Component { }); render() { - const isVideoRoom = this.props.type === RoomType.UnstableCall; + const isVideoRoom = this.props.type === RoomType.ElementVideo; let aliasField; if (this.state.joinRule === JoinRule.Public) { diff --git a/src/components/views/right_panel/RoomSummaryCard.tsx b/src/components/views/right_panel/RoomSummaryCard.tsx index 65654f37ea..018d2c6927 100644 --- a/src/components/views/right_panel/RoomSummaryCard.tsx +++ b/src/components/views/right_panel/RoomSummaryCard.tsx @@ -269,7 +269,7 @@ const RoomSummaryCard: React.FC = ({ room, onClose }) => { const isRoomEncrypted = useIsEncrypted(cli, room); const roomContext = useContext(RoomContext); const e2eStatus = roomContext.e2eStatus; - const isVideoRoom = useFeatureEnabled("feature_video_rooms") && room.isCallRoom(); + const isVideoRoom = useFeatureEnabled("feature_video_rooms") && room.isElementVideoRoom(); const alias = room.getCanonicalAlias() || room.getAltAliases()[0] || ""; const header = diff --git a/src/components/views/rooms/RoomList.tsx b/src/components/views/rooms/RoomList.tsx index b7e1f87dc5..69b5179af5 100644 --- a/src/components/views/rooms/RoomList.tsx +++ b/src/components/views/rooms/RoomList.tsx @@ -243,7 +243,7 @@ const UntaggedAuxButton = ({ tabIndex }: IAuxButtonProps) => { e.preventDefault(); e.stopPropagation(); closeMenu(); - showCreateNewRoom(activeSpace, RoomType.UnstableCall); + showCreateNewRoom(activeSpace, RoomType.ElementVideo); }} disabled={!canAddRooms} tooltip={canAddRooms ? undefined @@ -289,7 +289,7 @@ const UntaggedAuxButton = ({ tabIndex }: IAuxButtonProps) => { closeMenu(); defaultDispatcher.dispatch({ action: "view_create_room", - type: RoomType.UnstableCall, + type: RoomType.ElementVideo, }); }} /> } diff --git a/src/components/views/rooms/RoomListHeader.tsx b/src/components/views/rooms/RoomListHeader.tsx index cc85c4e6da..6b97e8a660 100644 --- a/src/components/views/rooms/RoomListHeader.tsx +++ b/src/components/views/rooms/RoomListHeader.tsx @@ -217,7 +217,7 @@ const RoomListHeader = ({ onVisibilityChange }: IProps) => { onClick={(e) => { e.preventDefault(); e.stopPropagation(); - showCreateNewRoom(activeSpace, RoomType.UnstableCall); + showCreateNewRoom(activeSpace, RoomType.ElementVideo); closePlusMenu(); }} /> } @@ -310,7 +310,7 @@ const RoomListHeader = ({ onVisibilityChange }: IProps) => { e.stopPropagation(); defaultDispatcher.dispatch({ action: "view_create_room", - type: RoomType.UnstableCall, + type: RoomType.ElementVideo, }); closePlusMenu(); }} diff --git a/src/components/views/rooms/RoomTile.tsx b/src/components/views/rooms/RoomTile.tsx index a2557506e2..30585b35ca 100644 --- a/src/components/views/rooms/RoomTile.tsx +++ b/src/components/views/rooms/RoomTile.tsx @@ -123,7 +123,7 @@ export default class RoomTile extends React.PureComponent { this.notificationState = RoomNotificationStateStore.instance.getRoomState(this.props.room); this.roomProps = EchoChamber.forRoom(this.props.room); - this.isVideoRoom = SettingsStore.getValue("feature_video_rooms") && this.props.room.isCallRoom(); + this.isVideoRoom = SettingsStore.getValue("feature_video_rooms") && this.props.room.isElementVideoRoom(); } private onRoomNameUpdate = (room: Room) => { diff --git a/src/createRoom.ts b/src/createRoom.ts index adfca7dd3a..f2b09bc0b3 100644 --- a/src/createRoom.ts +++ b/src/createRoom.ts @@ -129,7 +129,7 @@ export default async function createRoom(opts: IOpts): Promise { }; // In video rooms, allow all users to send video member updates - if (opts.roomType === RoomType.UnstableCall) { + if (opts.roomType === RoomType.ElementVideo) { createOpts.power_level_content_override = { events: { [VIDEO_CHANNEL_MEMBER]: 0, @@ -263,7 +263,7 @@ export default async function createRoom(opts: IOpts): Promise { } }).then(() => { // Set up video rooms with a Jitsi widget - if (opts.roomType === RoomType.UnstableCall) { + if (opts.roomType === RoomType.ElementVideo) { return addVideoChannel(roomId, createOpts.name); } }).then(function() { diff --git a/test/components/views/rooms/RoomTile-test.tsx b/test/components/views/rooms/RoomTile-test.tsx index b0a98c8b3c..92135c3b09 100644 --- a/test/components/views/rooms/RoomTile-test.tsx +++ b/test/components/views/rooms/RoomTile-test.tsx @@ -73,7 +73,7 @@ describe("RoomTile", () => { describe("video rooms", () => { const room = mkRoom(cli, "!1:example.org"); - room.isCallRoom.mockReturnValue(true); + room.isElementVideoRoom.mockReturnValue(true); it("tracks connection state", () => { const tile = mount( diff --git a/test/test-utils/test-utils.ts b/test/test-utils/test-utils.ts index 45edc7fa15..ca2737d3e2 100644 --- a/test/test-utils/test-utils.ts +++ b/test/test-utils/test-utils.ts @@ -367,7 +367,7 @@ export function mkStubRoom(roomId: string = null, name: string, client: MatrixCl getAvatarUrl: () => 'mxc://avatar.url/room.png', getMxcAvatarUrl: () => 'mxc://avatar.url/room.png', isSpaceRoom: jest.fn().mockReturnValue(false), - isCallRoom: jest.fn().mockReturnValue(false), + isElementVideoRoom: jest.fn().mockReturnValue(false), getUnreadNotificationCount: jest.fn(() => 0), getEventReadUpTo: jest.fn(() => null), getCanonicalAlias: jest.fn(),