From df55a4836fb64cff633718d384458937fd48d6ca Mon Sep 17 00:00:00 2001 From: Half-Shot Date: Mon, 27 Oct 2025 12:31:37 +0000 Subject: [PATCH] Cleanup --- src/@types/matrix-js-sdk.d.ts | 1 + .../views/settings/tabs/room/VoipRoomSettingsTab.tsx | 2 +- src/hooks/room/useElementCallPermissions.tsx | 11 ++--------- src/hooks/room/useRoomCall.tsx | 6 ++---- src/models/Call.ts | 2 +- src/settings/Settings.tsx | 3 ++- 6 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/@types/matrix-js-sdk.d.ts b/src/@types/matrix-js-sdk.d.ts index ff2e3952c4..16074e1984 100644 --- a/src/@types/matrix-js-sdk.d.ts +++ b/src/@types/matrix-js-sdk.d.ts @@ -1,4 +1,5 @@ /* +Copyright 2025 Element Creations Ltd. Copyright 2024, 2025 New Vector Ltd. Copyright 2024 The Matrix.org Foundation C.I.C. diff --git a/src/components/views/settings/tabs/room/VoipRoomSettingsTab.tsx b/src/components/views/settings/tabs/room/VoipRoomSettingsTab.tsx index 7c30abea7b..25d4fd0a33 100644 --- a/src/components/views/settings/tabs/room/VoipRoomSettingsTab.tsx +++ b/src/components/views/settings/tabs/room/VoipRoomSettingsTab.tsx @@ -1,4 +1,5 @@ /* +Copyright 2025 Element Creations Ltd. Copyright 2024 New Vector Ltd. Copyright 2022 The Matrix.org Foundation C.I.C. @@ -28,7 +29,6 @@ const ElementCallSwitch: React.FC = ({ room }) => { const onToggle = useCallback(() => { setBusy(true) void (async () => { - console.log({canStartCall, canAdjustCallPermissions}); try { if (canStartCall) { await disableCallInRoom(); diff --git a/src/hooks/room/useElementCallPermissions.tsx b/src/hooks/room/useElementCallPermissions.tsx index 163e78d358..2dab3049fa 100644 --- a/src/hooks/room/useElementCallPermissions.tsx +++ b/src/hooks/room/useElementCallPermissions.tsx @@ -1,15 +1,13 @@ /* -Copyright 2024 New Vector Ltd. -Copyright 2023 The Matrix.org Foundation C.I.C. +Copyright 2025 Element Creations Ltd. SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial Please see LICENSE files in the repository root for full details. */ import { EventType, JoinRule, RoomState, type Room } from "matrix-js-sdk/src/matrix"; -import { useCallback } from "react"; +import React, { useCallback } from "react"; -import type React from "react"; import { useFeatureEnabled } from "../useSettings"; import { useRoomState } from "../useRoomState"; import { _t } from "../../languageHandler"; @@ -51,12 +49,10 @@ function useLegacyCallPermissions(room: Room| LocalRoom): ElementCallPermissions ); const enableCallInRoom = useCallback(() => { - console.log('Enabling call'); const newContent = { events: {}, ...powerLevelContent }; const userLevel = newContent.events[EventType.RoomMessage] ?? powerLevelContent.users_default ?? 0; const moderatorLevel = powerLevelContent.kick ?? 50; const isPublic = room.getJoinRule() === JoinRule.Public; - console.log(newContent.events); newContent.events[ElementCallEventType.name] = isPublic ? moderatorLevel : userLevel; newContent.events[ElementCallMemberEventType.name] = userLevel; room.client.sendStateEvent(room.roomId, EventType.RoomPowerLevels, newContent); @@ -64,7 +60,6 @@ function useLegacyCallPermissions(room: Room| LocalRoom): ElementCallPermissions const disableCallInRoom = useCallback(() => { - console.log('Disabling call'); const newContent = { events: {}, ...powerLevelContent }; const adminLevel = newContent.events[EventType.RoomPowerLevels] ?? powerLevelContent.state_default ?? 100; newContent.events[ElementCallEventType.name] = adminLevel; @@ -96,7 +91,6 @@ const useSlotsCallPermissions = ( // TODO: Check that we are allowed to create audio/video calls, when the telephony PR lands. const createElementCallSlot = useCallback(async (): Promise => { - console.log('createElementCallSlot', { hasRoomSlot }); if (hasRoomSlot) { return true; } @@ -124,7 +118,6 @@ const useSlotsCallPermissions = ( }, [room, hasRoomSlot]); const removeElementCallSlot = useCallback(async (): Promise => { - console.log('removeElementCallSlot', { hasRoomSlot }); if (hasRoomSlot) { await room.client.sendStateEvent(room.roomId, "org.matrix.msc4143.rtc.slot", { }, "m.call#ROOM"); } diff --git a/src/hooks/room/useRoomCall.tsx b/src/hooks/room/useRoomCall.tsx index 6bb7bcb5b3..b186284cca 100644 --- a/src/hooks/room/useRoomCall.tsx +++ b/src/hooks/room/useRoomCall.tsx @@ -1,4 +1,5 @@ /* +Copyright 2025 Element Creations Ltd. Copyright 2024 New Vector Ltd. Copyright 2023 The Matrix.org Foundation C.I.C. @@ -143,7 +144,7 @@ export const useRoomCall = ( const callOptions = useMemo((): PlatformCallType[] => { const options: PlatformCallType[] = []; if (memberCount <= 2) { - // options.push(PlatformCallType.LegacyCall); + options.push(PlatformCallType.LegacyCall); } else if (mayEditWidgets || hasJitsiWidget) { options.push(PlatformCallType.JitsiCall); } @@ -215,7 +216,6 @@ export const useRoomCall = ( if (!callOptions.includes(PlatformCallType.LegacyCall) && !mayCreateElementCalls && !mayEditWidgets) { return State.NoPermission; } - return State.NoCall; }, [ callOptions, @@ -302,8 +302,6 @@ export const useRoomCall = ( hideVideoCallButton = true; } - console.log("useRoomCall", { voiceCallDisabledReason, videoCallDisabledReason, callOptions, hideVideoCallButton, hideVoiceCallButton, mayCreateElementCalls }); - /** * We've gone through all the steps */ diff --git a/src/models/Call.ts b/src/models/Call.ts index f72032da1f..9d483e7af7 100644 --- a/src/models/Call.ts +++ b/src/models/Call.ts @@ -1,4 +1,5 @@ /* +Copyright 2025 Element Creations Ltd. Copyright 2024 New Vector Ltd. Copyright 2022 The Matrix.org Foundation C.I.C. @@ -556,7 +557,6 @@ export interface WidgetGenerationParameters { * Skip showing the lobby screen of a call. */ skipLobby?: boolean; - useMSC4354?: boolean; } /** diff --git a/src/settings/Settings.tsx b/src/settings/Settings.tsx index ef19a6d488..0c24c739d3 100644 --- a/src/settings/Settings.tsx +++ b/src/settings/Settings.tsx @@ -1,4 +1,5 @@ /* +Copyright 2025 Element Creations Ltd. Copyright 2024, 2025 New Vector Ltd. Copyright 2018-2024 The Matrix.org Foundation C.I.C. Copyright 2017 Travis Ralston @@ -651,8 +652,8 @@ export const SETTINGS: Settings = { labsGroup: LabGroup.VoiceAndVideo, supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG_PRIORITISED, supportedLevelsAreOrdered: true, - controller: new ReloadOnChangeController(), displayName: _td("labs|group_calls"), + controller: new ReloadOnChangeController(), default: false, }, "feature_disable_call_per_sender_encryption": {