fix: add USE_VIDEO permission to Member role and fix single-user video mode

Two fixes:
1. Member role (0x663) was missing USE_VIDEO (0x800) and SHARE_SCREEN (0x1000)
   bits, causing "permission denied" when non-owner users tried to enable camera.
   Migration 006 updates Member permissions to 0x1E63.
2. checkVideoMode() now checks voice.localCamera immediately instead of waiting
   for the server's voice_state broadcast, so video grid shows instantly when
   a single user enables their camera.
This commit is contained in:
jevb
2026-03-19 17:19:56 +01:00
parent b79af83bda
commit 3c1cef00d6
2 changed files with 13 additions and 5 deletions
+7 -5
View File
@@ -178,11 +178,13 @@ export function createMainPage(options: MainPageOptions): MountableComponent {
if (isVideoMode) showChat();
return;
}
let anyCameraOn = false;
for (const user of channelUsers.values()) {
if (user.camera) {
anyCameraOn = true;
break;
let anyCameraOn = voice.localCamera; // Check local camera first (may not be in voiceUsers yet)
if (!anyCameraOn) {
for (const user of channelUsers.values()) {
if (user.camera) {
anyCameraOn = true;
break;
}
}
}
if (anyCameraOn && !isVideoMode) {
@@ -0,0 +1,6 @@
-- Migration 006: Add video and screenshare permissions to Member role
-- Member was missing USE_VIDEO (0x800) and SHARE_SCREEN (0x1000).
-- New value: 0x1E63 = SEND_MESSAGES | READ_MESSAGES | ATTACH_FILES |
-- ADD_REACTIONS | CONNECT_VOICE | SPEAK_VOICE |
-- USE_VIDEO | SHARE_SCREEN
UPDATE roles SET permissions = 7779 WHERE id = 4 AND name = 'Member';