From 789dba7b3db364d63050f5d7a1a954fc02892bd5 Mon Sep 17 00:00:00 2001 From: Timo <16718859+toger5@users.noreply.github.com> Date: Tue, 12 Aug 2025 12:07:59 +0200 Subject: [PATCH] Remove NoOneHere disabled reason. (#30524) * Remove NoOneHere disabled reason. This was used to prohibit starting calls if the user is alone in the room. Since there are currently issues with the user count calculation this can disable the button even when not appropriate. On top of that, there is a reason to start a call if the room was just created and the user is still waiting for the others to join the room to then join the call. Signed-off-by: Timo K * some ci fixes Signed-off-by: Timo K * fix test snapshots Signed-off-by: Timo K * fix test to expect enabled call buttons * Update snapshot for unit-tests/components/views/rooms/RoomHeader/RoomHeader-test.tsx --------- Signed-off-by: Timo K Co-authored-by: fkwp --- playwright/e2e/room/room-header.spec.ts | 7 +- src/hooks/room/useRoomCall.tsx | 12 --- src/i18n/strings/en_EN.json | 1 - .../__snapshots__/RoomView-test.tsx.snap | 24 +++--- .../rooms/RoomHeader/RoomHeader-test.tsx | 74 ------------------- .../__snapshots__/RoomHeader-test.tsx.snap | 20 ++--- 6 files changed, 24 insertions(+), 114 deletions(-) diff --git a/playwright/e2e/room/room-header.spec.ts b/playwright/e2e/room/room-header.spec.ts index 78e37cd4d2..5f14bfc85f 100644 --- a/playwright/e2e/room/room-header.spec.ts +++ b/playwright/e2e/room/room-header.spec.ts @@ -37,11 +37,8 @@ test.describe("Room Header", () => { await expect(header.locator(".mx_FacePile")).toBeVisible(); // There should be both a voice and a video call button - // but they'll be disabled - const callButtons = header.getByRole("button", { name: "There's no one here to call" }); - await expect(callButtons).toHaveCount(2); - await expect(callButtons.first()).toBeVisible(); - await expect(callButtons.last()).toBeVisible(); + await expect(header.getByRole("button", { name: "Video call" })).toBeVisible(); + await expect(header.getByRole("button", { name: "Voice call" })).toBeVisible(); await expect(header.getByRole("button", { name: "Threads" })).toBeVisible(); await expect(header.getByRole("button", { name: "Notifications" })).toBeVisible(); diff --git a/src/hooks/room/useRoomCall.tsx b/src/hooks/room/useRoomCall.tsx index b8bf925afc..9e450eed0e 100644 --- a/src/hooks/room/useRoomCall.tsx +++ b/src/hooks/room/useRoomCall.tsx @@ -32,7 +32,6 @@ import { type ViewRoomPayload } from "../../dispatcher/payloads/ViewRoomPayload" import { Action } from "../../dispatcher/actions"; import { CallStore, CallStoreEvent } from "../../stores/CallStore"; import { isVideoRoom } from "../../utils/video-rooms"; -import { useGuestAccessInformation } from "./useGuestAccessInformation"; import { UIFeature } from "../../settings/UIFeature"; import { BetaPill } from "../../components/views/beta/BetaCard"; import { type InteractionName } from "../../PosthogTrackers"; @@ -73,7 +72,6 @@ export const getPlatformCallTypeProps = ( const enum State { NoCall, - NoOneHere, NoPermission, Unpinned, Ongoing, @@ -197,7 +195,6 @@ export const useRoomCall = ( const connectedCalls = useEventEmitterState(CallStore.instance, CallStoreEvent.ConnectedCalls, () => Array.from(CallStore.instance.connectedCalls), ); - const { canInviteGuests } = useGuestAccessInformation(room); const state = useMemo((): State => { if (connectedCalls.find((call) => call.roomId != room.roomId)) { @@ -209,9 +206,6 @@ export const useRoomCall = ( if (hasLegacyCall) { return State.Ongoing; } - if (memberCount <= 1 && !canInviteGuests) { - return State.NoOneHere; - } if (!callOptions.includes(PlatformCallType.LegacyCall) && !mayCreateElementCalls && !mayEditWidgets) { return State.NoPermission; @@ -220,14 +214,12 @@ export const useRoomCall = ( }, [ callOptions, connectedCalls, - canInviteGuests, hasGroupCall, hasJitsiWidget, hasLegacyCall, hasManagedHybridWidget, mayCreateElementCalls, mayEditWidgets, - memberCount, promptPinWidget, room.roomId, ]); @@ -266,10 +258,6 @@ export const useRoomCall = ( voiceCallDisabledReason = _t("voip|disabled_ongoing_call"); videoCallDisabledReason = _t("voip|disabled_ongoing_call"); break; - case State.NoOneHere: - voiceCallDisabledReason = _t("voip|disabled_no_one_here"); - videoCallDisabledReason = _t("voip|disabled_no_one_here"); - break; case State.Unpinned: case State.NotJoined: case State.NoCall: diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index fb4a6f4c18..7b27b0bddf 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -3965,7 +3965,6 @@ "dialpad": "Dialpad", "disable_camera": "Turn off camera", "disable_microphone": "Mute microphone", - "disabled_no_one_here": "There's no one here to call", "disabled_no_perms_start_video_call": "You do not have permission to start video calls", "disabled_no_perms_start_voice_call": "You do not have permission to start voice calls", "disabled_ongoing_call": "Ongoing call", diff --git a/test/unit-tests/components/structures/__snapshots__/RoomView-test.tsx.snap b/test/unit-tests/components/structures/__snapshots__/RoomView-test.tsx.snap index 83bc568c70..d34321ba2e 100644 --- a/test/unit-tests/components/structures/__snapshots__/RoomView-test.tsx.snap +++ b/test/unit-tests/components/structures/__snapshots__/RoomView-test.tsx.snap @@ -1449,8 +1449,8 @@ exports[`RoomView should not display the timeline when the room encryption is lo