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

Commit

Permalink
Add menu for legacy and element call in 1:1 rooms (#11910)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

* fix tests

Signed-off-by: Timo K <[email protected]>

---------

Signed-off-by: Timo K <[email protected]>
  • Loading branch information
toger5 authored Nov 22, 2023
1 parent a4d532d commit 6f715ab
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
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

0 comments on commit 6f715ab

Please sign in to comment.