From 6f715ab8034ae6ddf5dfc4516e63996e1ca5be98 Mon Sep 17 00:00:00 2001 From: Timo <16718859+toger5@users.noreply.github.com> Date: Wed, 22 Nov 2023 11:35:51 +0100 Subject: [PATCH] Add menu for legacy and element call in 1:1 rooms (#11910) * Add menu for legacy and element call in 1:1 rooms This allows to also initiate element call calls in 1:1 rooms Signed-off-by: Timo K * fix tests Signed-off-by: Timo K --------- Signed-off-by: Timo K --- src/components/views/rooms/LegacyRoomHeader.tsx | 12 ++++++++---- src/i18n/strings/en_EN.json | 1 + .../components/views/rooms/LegacyRoomHeader-test.tsx | 2 ++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/components/views/rooms/LegacyRoomHeader.tsx b/src/components/views/rooms/LegacyRoomHeader.tsx index e968e26f38..cad8cb8814 100644 --- a/src/components/views/rooms/LegacyRoomHeader.tsx +++ b/src/components/views/rooms/LegacyRoomHeader.tsx @@ -126,7 +126,7 @@ interface VideoCallButtonProps { room: Room; busy: boolean; setBusy: (value: boolean) => void; - behavior: DisabledWithReason | "legacy_or_jitsi" | "element" | "jitsi_or_element"; + behavior: DisabledWithReason | "legacy_or_jitsi" | "element" | "jitsi_or_element" | "legacy_or_element"; } /** @@ -178,7 +178,7 @@ const VideoCallButton: FC = ({ room, busy, setBusy, behavi disabled: false, }; } else { - // behavior === "jitsi_or_element" + // behavior === "jitsi_or_element" | "legacy_or_element" return { onClick: async (ev: ButtonEvent): Promise => { ev.preventDefault(); @@ -215,7 +215,11 @@ const VideoCallButton: FC = ({ room, busy, setBusy, behavi = ({ room }) => { return ( <> {makeVoiceCallButton("legacy_or_jitsi")} - {makeVideoCallButton("legacy_or_jitsi")} + {makeVideoCallButton("legacy_or_element")} ); } else if (mayEditWidgets) { diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 1f8c633ea3..362ae7e55c 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1933,6 +1933,7 @@ "show_widgets_button": "Show Widgets", "video_call_button_ec": "Video call (%(brand)s)", "video_call_button_jitsi": "Video call (Jitsi)", + "video_call_button_legacy": "Legacy video call", "video_call_ec_change_layout": "Change layout", "video_call_ec_layout_freedom": "Freedom", "video_call_ec_layout_spotlight": "Spotlight", diff --git a/test/components/views/rooms/LegacyRoomHeader-test.tsx b/test/components/views/rooms/LegacyRoomHeader-test.tsx index 67ef566129..575f1ddf1a 100644 --- a/test/components/views/rooms/LegacyRoomHeader-test.tsx +++ b/test/components/views/rooms/LegacyRoomHeader-test.tsx @@ -347,6 +347,8 @@ describe("LegacyRoomHeader", () => { placeCallSpy.mockClear(); fireEvent.click(screen.getByRole("button", { name: "Video call" })); await act(() => Promise.resolve()); // Allow effects to settle + fireEvent.click(screen.getByRole("menuitem", { name: "Legacy video call" })); + await act(() => Promise.resolve()); // Allow effects to settle expect(placeCallSpy).toHaveBeenCalledWith(room.roomId, CallType.Video); }, );