diff --git a/config.sample.json b/config.sample.json index 3bc875cb7e..54656418bd 100644 --- a/config.sample.json +++ b/config.sample.json @@ -43,7 +43,6 @@ }, "element_call": { "url": "https://call.element.io", - "participant_limit": 8, "brand": "Element Call" }, "map_style_url": "https://api.maptiler.com/maps/streets/style.json?key=fU3vlMsMn4Jb6dnEIFsx" diff --git a/docs/config.md b/docs/config.md index 1007950e72..0cb3c702a3 100644 --- a/docs/config.md +++ b/docs/config.md @@ -391,8 +391,6 @@ The VoIP and Jitsi options are: 6. `element_call`: Optional configuration for native group calls using Element Call, with the following subkeys: - `use_exclusively`: A boolean specifying whether Element Call should be used exclusively as the only VoIP stack in the app, removing the ability to start legacy 1:1 calls or Jitsi calls. Defaults to `false`. - - `participant_limit`: The maximum number of users who can join a call; if - this number is exceeded, the user will not be able to join a given call. - `brand`: Optional name for the app. Defaults to `Element Call`. This is used throughout the application in various strings/locations. - `guest_spa_url`: Optional URL for an Element Call single-page app (SPA), diff --git a/src/IConfigOptions.ts b/src/IConfigOptions.ts index 952d35e88d..a0ff9f0d6f 100644 --- a/src/IConfigOptions.ts +++ b/src/IConfigOptions.ts @@ -120,7 +120,6 @@ export interface IConfigOptions { element_call: { guest_spa_url?: string; use_exclusively?: boolean; - participant_limit?: number; brand?: string; }; diff --git a/src/SdkConfig.ts b/src/SdkConfig.ts index 71ac6736c9..ab921bedc5 100644 --- a/src/SdkConfig.ts +++ b/src/SdkConfig.ts @@ -30,7 +30,6 @@ export const DEFAULTS: DeepReadonly = { }, element_call: { use_exclusively: false, - participant_limit: 8, brand: "Element Call", }, diff --git a/src/components/views/messages/CallEvent.tsx b/src/components/views/messages/CallEvent.tsx index f8efd8381e..2bdd0a8245 100644 --- a/src/components/views/messages/CallEvent.tsx +++ b/src/components/views/messages/CallEvent.tsx @@ -11,12 +11,7 @@ import React, { type Ref, useCallback, useContext, useMemo, type JSX } from "rea import type { MatrixEvent, RoomMember } from "matrix-js-sdk/src/matrix"; import { ConnectionState, type ElementCall } from "../../../models/Call"; import { _t } from "../../../languageHandler"; -import { - useCall, - useConnectionState, - useJoinCallButtonDisabledTooltip, - useParticipatingMembers, -} from "../../../hooks/useCall"; +import { useCall, useConnectionState, useParticipatingMembers } from "../../../hooks/useCall"; import defaultDispatcher from "../../../dispatcher/dispatcher"; import type { ViewRoomPayload } from "../../../dispatcher/payloads/ViewRoomPayload"; import { Action } from "../../../dispatcher/actions"; @@ -102,7 +97,6 @@ interface ActiveLoadedCallEventProps { const ActiveLoadedCallEvent = ({ mxEvent, call, ref }: ActiveLoadedCallEventProps): JSX.Element => { const connectionState = useConnectionState(call); const participatingMembers = useParticipatingMembers(call); - const joinCallButtonDisabledTooltip = useJoinCallButtonDisabledTooltip(call); const connect = useCallback( (ev: ButtonEvent) => { @@ -146,7 +140,6 @@ const ActiveLoadedCallEvent = ({ mxEvent, call, ref }: ActiveLoadedCallEventProp participatingMembers={participatingMembers} buttonText={buttonText} buttonKind={buttonKind} - buttonDisabledTooltip={joinCallButtonDisabledTooltip ?? undefined} onButtonClick={onButtonClick} /> ); diff --git a/src/hooks/useCall.ts b/src/hooks/useCall.ts index db0660df2b..430f316bc6 100644 --- a/src/hooks/useCall.ts +++ b/src/hooks/useCall.ts @@ -12,8 +12,6 @@ import type { RoomMember } from "matrix-js-sdk/src/matrix"; import { type Call, ConnectionState, CallEvent } from "../models/Call"; import { useTypedEventEmitterState, useEventEmitter } from "./useEventEmitter"; import { CallStore, CallStoreEvent } from "../stores/CallStore"; -import SdkConfig, { DEFAULTS } from "../SdkConfig"; -import { _t } from "../languageHandler"; export const useCall = (roomId: string): Call | null => { const [call, setCall] = useState(() => CallStore.instance.getCall(roomId)); @@ -41,7 +39,7 @@ export const useConnectionState = (call: Call | null): ConnectionState => useCallback((state) => state ?? call?.connectionState ?? ConnectionState.Disconnected, [call]), ); -export const useParticipants = (call: Call | null): Map> => { +const useParticipants = (call: Call | null): Map> => { return useTypedEventEmitterState( call ?? undefined, CallEvent.Participants, @@ -53,9 +51,7 @@ export const useParticipantCount = (call: Call | null): number => { const participants = useParticipants(call); return useMemo(() => { - let count = 0; - for (const devices of participants.values()) count += devices.size; - return count; + return [...participants.values()].reduce((count, set) => count + set.size, 0); }, [participants]); }; @@ -71,15 +67,3 @@ export const useParticipatingMembers = (call: Call): RoomMember[] => { return members; }, [participants]); }; - -export const useFull = (call: Call | null): boolean => { - return ( - useParticipantCount(call) >= - (SdkConfig.get("element_call").participant_limit ?? DEFAULTS.element_call.participant_limit!) - ); -}; - -export const useJoinCallButtonDisabledTooltip = (call: Call | null): string | null => { - const isFull = useFull(call); - return isFull ? _t("voip|join_button_tooltip_call_full") : null; -}; diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 400c2d1679..6947a2c482 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -4045,7 +4045,6 @@ "hide_sidebar_button": "Hide sidebar", "input_devices": "Input devices", "jitsi_call": "Jitsi Conference", - "join_button_tooltip_call_full": "Sorry — this call is currently full", "legacy_call": "Legacy Call", "maximise": "Fill screen", "maximise_call": "Maximise call", diff --git a/src/toasts/IncomingCallToast.tsx b/src/toasts/IncomingCallToast.tsx index ec0dd8f3ec..df863444f8 100644 --- a/src/toasts/IncomingCallToast.tsx +++ b/src/toasts/IncomingCallToast.tsx @@ -23,7 +23,7 @@ import { type ViewRoomPayload } from "../dispatcher/payloads/ViewRoomPayload"; import { Action } from "../dispatcher/actions"; import ToastStore from "../stores/ToastStore"; import { LiveContentSummary, LiveContentType } from "../components/views/rooms/LiveContentSummary"; -import { useCall, useJoinCallButtonDisabledTooltip, useParticipantCount } from "../hooks/useCall"; +import { useCall, useParticipantCount } from "../hooks/useCall"; import AccessibleButton, { type ButtonEvent } from "../components/views/elements/AccessibleButton"; import { useDispatcher } from "../hooks/useDispatcher"; import { type ActionPayload } from "../dispatcher/payloads"; @@ -70,22 +70,13 @@ interface JoinCallButtonWithCallProps { isRinging: boolean; } -function JoinCallButtonWithCall({ - onClick, - call, - disabledTooltip, - isRinging, -}: JoinCallButtonWithCallProps): JSX.Element { - let disTooltip = disabledTooltip; - const disabledBecauseFullTooltip = useJoinCallButtonDisabledTooltip(call); - disTooltip = disabledTooltip ?? disabledBecauseFullTooltip ?? undefined; - +function JoinCallButtonWithCall({ onClick, disabledTooltip, isRinging }: JoinCallButtonWithCallProps): JSX.Element { return ( - +