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

Commit 68e8fa7

Browse files
committed
Tests
Signed-off-by: Michael Telatynski <[email protected]>
1 parent e54dd60 commit 68e8fa7

File tree

3 files changed

+209
-167
lines changed

3 files changed

+209
-167
lines changed

src/hooks/room/useRoomCall.ts

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import { Container, WidgetLayoutStore } from "../../stores/widgets/WidgetLayoutS
3232
import { useRoomState } from "../useRoomState";
3333
import { _t } from "../../languageHandler";
3434
import { isManagedHybridWidget } from "../../widgets/ManagedHybrid";
35+
import { IApp } from "../../stores/WidgetStore";
3536

3637
export type PlatformCallType = "element_call" | "jitsi_or_element_call" | "legacy_or_jitsi";
3738

@@ -91,12 +92,14 @@ export const useRoomCall = (
9192
if (mayCreateElementCalls && hasJitsiWidget) {
9293
return "jitsi_or_element_call";
9394
}
94-
if (useElementCallExclusively || mayCreateElementCalls) {
95-
// Looks like for Audio this was previously legacy_or_jitsi
95+
if (useElementCallExclusively) {
9696
return "element_call";
9797
}
98-
if (mayEditWidgets) {
99-
return "jitsi_or_element_call";
98+
if (memberCount <= 2) {
99+
return "legacy_or_jitsi";
100+
}
101+
if (mayCreateElementCalls) {
102+
return "element_call";
100103
}
101104
}
102105
return "legacy_or_jitsi";
@@ -106,9 +109,17 @@ export const useRoomCall = (
106109
mayCreateElementCalls,
107110
hasJitsiWidget,
108111
useElementCallExclusively,
109-
mayEditWidgets,
112+
memberCount,
110113
]);
111-
const widget = callType === "element_call" ? groupCall?.widget : jitsiWidget ?? managedHybridWidget;
114+
115+
let widget: IApp | undefined;
116+
if (callType === "legacy_or_jitsi") {
117+
widget = jitsiWidget ?? managedHybridWidget;
118+
} else if (callType === "element_call") {
119+
widget = groupCall?.widget;
120+
} else {
121+
widget = groupCall?.widget ?? jitsiWidget;
122+
}
112123

113124
const [canPinWidget, setCanPinWidget] = useState(false);
114125
const [widgetPinned, setWidgetPinned] = useState(false);
@@ -180,7 +191,7 @@ export const useRoomCall = (
180191
switch (state) {
181192
case State.NoPermission:
182193
voiceCallDisabledReason = _t("You do not have permission to start voice calls");
183-
videoCallDisabledReason = _t("You do not have permission to start voice calls");
194+
videoCallDisabledReason = _t("You do not have permission to start video calls");
184195
break;
185196
case State.Ongoing:
186197
voiceCallDisabledReason = _t("Ongoing call");

0 commit comments

Comments
 (0)