This commit is contained in:
Half-Shot 2025-10-27 12:31:37 +00:00
parent 06471e1216
commit df55a4836f
6 changed files with 9 additions and 16 deletions

View File

@ -1,4 +1,5 @@
/*
Copyright 2025 Element Creations Ltd.
Copyright 2024, 2025 New Vector Ltd.
Copyright 2024 The Matrix.org Foundation C.I.C.

View File

@ -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<ElementCallSwitchProps> = ({ room }) => {
const onToggle = useCallback(() => {
setBusy(true)
void (async () => {
console.log({canStartCall, canAdjustCallPermissions});
try {
if (canStartCall) {
await disableCallInRoom();

View File

@ -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<boolean> => {
console.log('createElementCallSlot', { hasRoomSlot });
if (hasRoomSlot) {
return true;
}
@ -124,7 +118,6 @@ const useSlotsCallPermissions = (
}, [room, hasRoomSlot]);
const removeElementCallSlot = useCallback(async (): Promise<void> => {
console.log('removeElementCallSlot', { hasRoomSlot });
if (hasRoomSlot) {
await room.client.sendStateEvent(room.roomId, "org.matrix.msc4143.rtc.slot", { }, "m.call#ROOM");
}

View File

@ -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
*/

View File

@ -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;
}
/**

View File

@ -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": {