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 <toger5@hotmail.de>

* fix tests

Signed-off-by: Timo K <toger5@hotmail.de>

---------

Signed-off-by: Timo K <toger5@hotmail.de>
pull/28788/head^2
Timo 2023-11-22 11:35:51 +01:00 committed by GitHub
parent a4d532d09c
commit 6f715ab803
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

View File

@ -126,7 +126,7 @@ interface VideoCallButtonProps {
room: Room; room: Room;
busy: boolean; busy: boolean;
setBusy: (value: boolean) => void; 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<VideoCallButtonProps> = ({ room, busy, setBusy, behavi
disabled: false, disabled: false,
}; };
} else { } else {
// behavior === "jitsi_or_element" // behavior === "jitsi_or_element" | "legacy_or_element"
return { return {
onClick: async (ev: ButtonEvent): Promise<void> => { onClick: async (ev: ButtonEvent): Promise<void> => {
ev.preventDefault(); ev.preventDefault();
@ -215,7 +215,11 @@ const VideoCallButton: FC<VideoCallButtonProps> = ({ room, busy, setBusy, behavi
<IconizedContextMenu {...aboveLeftOf(buttonRect)} onFinished={closeMenu}> <IconizedContextMenu {...aboveLeftOf(buttonRect)} onFinished={closeMenu}>
<IconizedContextMenuOptionList> <IconizedContextMenuOptionList>
<IconizedContextMenuOption <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} onClick={onJitsiClick}
/> />
<IconizedContextMenuOption <IconizedContextMenuOption
@ -319,7 +323,7 @@ const CallButtons: FC<CallButtonsProps> = ({ room }) => {
return ( return (
<> <>
{makeVoiceCallButton("legacy_or_jitsi")} {makeVoiceCallButton("legacy_or_jitsi")}
{makeVideoCallButton("legacy_or_jitsi")} {makeVideoCallButton("legacy_or_element")}
</> </>
); );
} else if (mayEditWidgets) { } else if (mayEditWidgets) {

View File

@ -1933,6 +1933,7 @@
"show_widgets_button": "Show Widgets", "show_widgets_button": "Show Widgets",
"video_call_button_ec": "Video call (%(brand)s)", "video_call_button_ec": "Video call (%(brand)s)",
"video_call_button_jitsi": "Video call (Jitsi)", "video_call_button_jitsi": "Video call (Jitsi)",
"video_call_button_legacy": "Legacy video call",
"video_call_ec_change_layout": "Change layout", "video_call_ec_change_layout": "Change layout",
"video_call_ec_layout_freedom": "Freedom", "video_call_ec_layout_freedom": "Freedom",
"video_call_ec_layout_spotlight": "Spotlight", "video_call_ec_layout_spotlight": "Spotlight",

View File

@ -347,6 +347,8 @@ describe("LegacyRoomHeader", () => {
placeCallSpy.mockClear(); placeCallSpy.mockClear();
fireEvent.click(screen.getByRole("button", { name: "Video call" })); fireEvent.click(screen.getByRole("button", { name: "Video call" }));
await act(() => Promise.resolve()); // Allow effects to settle 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); expect(placeCallSpy).toHaveBeenCalledWith(room.roomId, CallType.Video);
}, },
); );