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

Add menu for legacy and element call in 1:1 rooms #11910

Merged
merged 2 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/components/views/rooms/LegacyRoomHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}

/**
Expand Down Expand Up @@ -178,7 +178,7 @@ const VideoCallButton: FC<VideoCallButtonProps> = ({ room, busy, setBusy, behavi
disabled: false,
};
} else {
// behavior === "jitsi_or_element"
// behavior === "jitsi_or_element" | "legacy_or_element"
return {
onClick: async (ev: ButtonEvent): Promise<void> => {
ev.preventDefault();
Expand Down Expand Up @@ -215,7 +215,11 @@ const VideoCallButton: FC<VideoCallButtonProps> = ({ room, busy, setBusy, behavi
<IconizedContextMenu {...aboveLeftOf(buttonRect)} onFinished={closeMenu}>
<IconizedContextMenuOptionList>
<IconizedContextMenuOption
label={_t("room|header|video_call_button_jitsi")}
label={
behavior == "legacy_or_element"
? _t("room|header|video_call_button_legacy")
: _t("room|header|video_call_button_jitsi")
}
onClick={onJitsiClick}
/>
<IconizedContextMenuOption
Expand Down Expand Up @@ -319,7 +323,7 @@ const CallButtons: FC<CallButtonsProps> = ({ room }) => {
return (
<>
{makeVoiceCallButton("legacy_or_jitsi")}
{makeVideoCallButton("legacy_or_jitsi")}
{makeVideoCallButton("legacy_or_element")}
</>
);
} else if (mayEditWidgets) {
Expand Down
1 change: 1 addition & 0 deletions src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions test/components/views/rooms/LegacyRoomHeader-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
);
Expand Down
Loading