Mute on join if ZED_IMPERSONATE is set

Max Brunsfeld created

Change summary

crates/call/src/room.rs | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

Detailed changes

crates/call/src/room.rs 🔗

@@ -172,7 +172,7 @@ impl Room {
             cx.spawn(|this, mut cx| async move {
                 connect.await?;
 
-                if !cx.read(|cx| settings::get::<CallSettings>(cx).mute_on_join) {
+                if !cx.read(Self::mute_on_join) {
                     this.update(&mut cx, |this, cx| this.share_microphone(cx))
                         .await?;
                 }
@@ -301,6 +301,10 @@ impl Room {
         })
     }
 
+    pub fn mute_on_join(cx: &AppContext) -> bool {
+        settings::get::<CallSettings>(cx).mute_on_join || client::IMPERSONATE_LOGIN.is_some()
+    }
+
     fn from_join_response(
         response: proto::JoinRoomResponse,
         client: Arc<Client>,
@@ -1124,7 +1128,7 @@ impl Room {
         self.live_kit
             .as_ref()
             .and_then(|live_kit| match &live_kit.microphone_track {
-                LocalTrack::None => Some(settings::get::<CallSettings>(cx).mute_on_join),
+                LocalTrack::None => Some(Self::mute_on_join(cx)),
                 LocalTrack::Pending { muted, .. } => Some(*muted),
                 LocalTrack::Published { muted, .. } => Some(*muted),
             })