diff --git a/src/hooks/room/useRoomCall.tsx b/src/hooks/room/useRoomCall.tsx
index e0dfbdcdeb..8d7667aa7d 100644
--- a/src/hooks/room/useRoomCall.tsx
+++ b/src/hooks/room/useRoomCall.tsx
@@ -10,7 +10,7 @@ import { type Room } from "matrix-js-sdk/src/matrix";
import React, { type ReactNode, useCallback, useEffect, useMemo, useState } from "react";
import { CallType } from "matrix-js-sdk/src/webrtc/call";
-import { useFeatureEnabled } from "../useSettings";
+import { useFeatureEnabled, useSettingValue } from "../useSettings";
import SdkConfig from "../../SdkConfig";
import { useEventEmitter, useEventEmitterState } from "../useEventEmitter";
import LegacyCallHandler, { LegacyCallHandlerEvent } from "../../LegacyCallHandler";
@@ -33,7 +33,6 @@ import { Action } from "../../dispatcher/actions";
import { CallStore, CallStoreEvent } from "../../stores/CallStore";
import { isVideoRoom } from "../../utils/video-rooms";
import { useGuestAccessInformation } from "./useGuestAccessInformation";
-import SettingsStore from "../../settings/SettingsStore";
import { UIFeature } from "../../settings/UIFeature";
import { BetaPill } from "../../components/views/beta/BetaCard";
import { type InteractionName } from "../../PosthogTrackers";
@@ -102,6 +101,8 @@ export const useRoomCall = (
} => {
// settings
const groupCallsEnabled = useFeatureEnabled("feature_group_calls");
+ const widgetsFeatureEnabled = useSettingValue(UIFeature.Widgets);
+ const voipFeatureEnabled = useSettingValue(UIFeature.Voip);
const useElementCallExclusively = useMemo(() => {
return SdkConfig.get("element_call").use_exclusively;
}, []);
@@ -285,8 +286,8 @@ export const useRoomCall = (
// We hide the voice call button if it'd have the same effect as the video call button
let hideVoiceCallButton = isManagedHybridWidgetEnabled(room) || !callOptions.includes(PlatformCallType.LegacyCall);
let hideVideoCallButton = false;
- // We hide both buttons if they require widgets but widgets are disabled.
- if (memberCount > 2 && !SettingsStore.getValue(UIFeature.Widgets)) {
+ // We hide both buttons if they require widgets but widgets are disabled, or if the Voip feature is disabled.
+ if ((memberCount > 2 && !widgetsFeatureEnabled) || !voipFeatureEnabled) {
hideVoiceCallButton = true;
hideVideoCallButton = true;
}
diff --git a/test/unit-tests/components/views/rooms/RoomHeader/RoomHeader-test.tsx b/test/unit-tests/components/views/rooms/RoomHeader/RoomHeader-test.tsx
index 17d1a048c2..b93a26c412 100644
--- a/test/unit-tests/components/views/rooms/RoomHeader/RoomHeader-test.tsx
+++ b/test/unit-tests/components/views/rooms/RoomHeader/RoomHeader-test.tsx
@@ -226,6 +226,37 @@ describe("RoomHeader", () => {
expect(screen.queryByRole("button", { name: "Voice call" })).not.toBeInTheDocument();
});
+ describe("UIFeature.Voip disabled", () => {
+ beforeEach(() => {
+ SdkConfig.put({
+ setting_defaults: {
+ [UIFeature.Voip]: false,
+ },
+ });
+ });
+
+ afterEach(() => {
+ SdkConfig.reset();
+ jest.restoreAllMocks();
+ });
+
+ it("should not show call buttons in rooms smaller than 3 members", async () => {
+ mockRoomMembers(room, 2);
+ render(, getWrapper());
+
+ expect(screen.queryByRole("button", { name: "Video call" })).not.toBeInTheDocument();
+ expect(screen.queryByRole("button", { name: "Voice call" })).not.toBeInTheDocument();
+ });
+
+ it("should not show call button in rooms larger than 2 members", async () => {
+ mockRoomMembers(room, 3);
+ render(, getWrapper());
+
+ expect(screen.queryByRole("button", { name: "Video call" })).not.toBeInTheDocument();
+ expect(screen.queryByRole("button", { name: "Voice call" })).not.toBeInTheDocument();
+ });
+ });
+
describe("UIFeature.Widgets enabled (default)", () => {
beforeEach(() => {
SdkConfig.put({
diff --git a/test/unit-tests/components/views/rooms/RoomHeader/__snapshots__/RoomHeader-test.tsx.snap b/test/unit-tests/components/views/rooms/RoomHeader/__snapshots__/RoomHeader-test.tsx.snap
index 80ca43e337..a32d00d282 100644
--- a/test/unit-tests/components/views/rooms/RoomHeader/__snapshots__/RoomHeader-test.tsx.snap
+++ b/test/unit-tests/components/views/rooms/RoomHeader/__snapshots__/RoomHeader-test.tsx.snap
@@ -55,7 +55,7 @@ exports[`RoomHeader dm does not show the face pile for DMs 1`] = `
style="--cpd-icon-button-size: 100%; --cpd-color-icon-tertiary: var(--cpd-color-icon-disabled);"
>