From e9543ce6d610cd79ad7d89d8a47bd57493ab22dd Mon Sep 17 00:00:00 2001 From: J3vb Date: Thu, 2 Apr 2026 13:42:00 +0200 Subject: [PATCH] fix: video grid auto-opens only for local camera/screenshare (BUG-105) Refine auto-open to match Discord behavior: grid opens automatically when the local user enables camera or screenshare, but NOT when remote users do. Remote video requires clicking the user row to open. --- .../src/pages/main-page/VideoModeController.ts | 6 ++++-- .../tests/unit/video-mode-controller.test.ts | 10 ++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Client/tauri-client/src/pages/main-page/VideoModeController.ts b/Client/tauri-client/src/pages/main-page/VideoModeController.ts index 93487b4e..4a56389f 100644 --- a/Client/tauri-client/src/pages/main-page/VideoModeController.ts +++ b/Client/tauri-client/src/pages/main-page/VideoModeController.ts @@ -107,8 +107,10 @@ export function createVideoModeController(opts: VideoModeControllerOptions): Vid if (!anyVideoOn && videoMode) { showChat(); } - // BUG-105: Auto-open video grid when any video stream becomes active. - if (anyVideoOn && !videoMode) { + // BUG-105: Auto-open video grid only for LOCAL camera/screenshare. + // Remote streams require manual click (Discord-style behavior). + const localVideoOn = voice.localCamera || voice.localScreenshare; + if (localVideoOn && !videoMode) { showVideoGrid(); } diff --git a/Client/tauri-client/tests/unit/video-mode-controller.test.ts b/Client/tauri-client/tests/unit/video-mode-controller.test.ts index 0ba7c8ee..1f52cdac 100644 --- a/Client/tauri-client/tests/unit/video-mode-controller.test.ts +++ b/Client/tauri-client/tests/unit/video-mode-controller.test.ts @@ -104,7 +104,7 @@ describe("createVideoModeController", () => { expect(ctrl.isVideoMode()).toBe(false); }); - it("checkVideoMode auto-opens video grid when remote has camera (BUG-105)", () => { + it("checkVideoMode does NOT auto-open for remote camera (BUG-105)", () => { const users = new Map([[2, { userId: 2, camera: true, screenshare: false, username: "bob" }]]); mockVoiceStoreGetState.mockReturnValue( makeVoiceState({ currentChannelId: 10, voiceUsers: new Map([[10, users]]) }), @@ -118,7 +118,8 @@ describe("createVideoModeController", () => { }); ctrl.checkVideoMode(); - expect(ctrl.isVideoMode()).toBe(true); + // Remote streams require manual click — no auto-open + expect(ctrl.isVideoMode()).toBe(false); }); it("checkVideoMode auto-closes video grid when no streams remain", () => { @@ -359,7 +360,7 @@ describe("createVideoModeController", () => { expect(vg.removeStream).toHaveBeenCalledWith(1_000_001); }); - it("checkVideoMode auto-opens when remote has screenshare on (BUG-105)", () => { + it("checkVideoMode does NOT auto-open for remote screenshare (BUG-105)", () => { const users = new Map([ [1, { userId: 1, camera: false, screenshare: false, username: "me" }], [2, { userId: 2, camera: false, screenshare: true, username: "bob" }], @@ -375,7 +376,8 @@ describe("createVideoModeController", () => { }); ctrl.checkVideoMode(); - expect(ctrl.isVideoMode()).toBe(true); + // Remote streams require manual click — no auto-open + expect(ctrl.isVideoMode()).toBe(false); }); // -----------------------------------------------------------------------