From 234a7996eee01f3940c79e610615c312acdcdd44 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Fu=C3=9F?= <m.fuss@opentalk.eu>
Date: Thu, 13 Mar 2025 15:14:29 +0100
Subject: [PATCH] fix: exclude moderators from microphone restrictions

Closes #978
---
 .../opentalk-signaling-module-livekit/src/lib.rs   | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/crates/opentalk-signaling-module-livekit/src/lib.rs b/crates/opentalk-signaling-module-livekit/src/lib.rs
index 1c0ca4281..e8748d4e9 100644
--- a/crates/opentalk-signaling-module-livekit/src/lib.rs
+++ b/crates/opentalk-signaling-module-livekit/src/lib.rs
@@ -570,12 +570,14 @@ impl Livekit {
             .screen_share_requires_permission;
 
         let mut available_sources = LIVEKIT_MEDIA_SOURCES.to_vec();
-        if let MicrophoneRestrictionState::Enabled {
-            unrestricted_participants,
-        } = &microphone_restriction_state
-        {
-            if !unrestricted_participants.contains(&self.participant_id) {
-                available_sources.retain(|s| s != &TrackSource::Microphone);
+        if !self.role.is_moderator() {
+            if let MicrophoneRestrictionState::Enabled {
+                unrestricted_participants,
+            } = &microphone_restriction_state
+            {
+                if !unrestricted_participants.contains(&self.participant_id) {
+                    available_sources.retain(|s| s != &TrackSource::Microphone);
+                }
             }
         }
 
-- 
GitLab