Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Display intended mute status while still connecting to a room
Max Brunsfeld13982fe2f4a4
diff --git a/crates/call/src/room.rs b/crates/call/src/room.rsindex 683ff6f4df3..5a4bc8329f6 100644--- a/crates/call/src/room.rs+++ b/crates/call/src/room.rs@@ -1116,11 +1116,11 @@ impl Room {})}- pub fn is_muted(&self) -> bool {+ pub fn is_muted(&self, cx: &AppContext) -> bool {self.live_kit.as_ref().and_then(|live_kit| match &live_kit.microphone_track {- LocalTrack::None => Some(true),+ LocalTrack::None => Some(settings::get::<CallSettings>(cx).mute_on_join),LocalTrack::Pending { muted, .. } => Some(*muted),LocalTrack::Published { muted, .. } => Some(*muted),})@@ -1310,7 +1310,7 @@ impl Room {}pub fn toggle_mute(&mut self, cx: &mut ModelContext<Self>) -> Result<Task<Result<()>>> {- let should_mute = !self.is_muted();+ let should_mute = !self.is_muted(cx);if let Some(live_kit) = self.live_kit.as_mut() {if matches!(live_kit.microphone_track, LocalTrack::None) {return Ok(self.share_microphone(cx));diff --git a/crates/collab_ui/src/collab_titlebar_item.rs b/crates/collab_ui/src/collab_titlebar_item.rsindex 97881f9a50b..22f294d3fc1 100644--- a/crates/collab_ui/src/collab_titlebar_item.rs+++ b/crates/collab_ui/src/collab_titlebar_item.rs@@ -90,7 +90,7 @@ impl View for CollabTitlebarItem {right_container.add_children(self.render_in_call_share_unshare_button(&workspace, &theme, cx));right_container.add_child(self.render_leave_call(&theme, cx));- let muted = room.read(cx).is_muted();+ let muted = room.read(cx).is_muted(cx);let speaking = room.read(cx).is_speaking();left_container.add_child(self.render_current_user(&workspace, &theme, &user, peer_id, muted, speaking, cx),@@ -544,7 +544,7 @@ impl CollabTitlebarItem {) -> AnyElement<Self> {let icon;let tooltip;- let is_muted = room.read(cx).is_muted();+ let is_muted = room.read(cx).is_muted(cx);if is_muted {icon = "icons/radix/mic-mute.svg";tooltip = "Unmute microphone";diff --git a/crates/collab_ui/src/collab_ui.rs b/crates/collab_ui/src/collab_ui.rsindex 1e48026f466..f2ba35967fe 100644--- a/crates/collab_ui/src/collab_ui.rs+++ b/crates/collab_ui/src/collab_ui.rs@@ -64,7 +64,7 @@ pub fn toggle_mute(_: &ToggleMute, cx: &mut AppContext) {if let Some(room) = call.room().cloned() {let client = call.client();room.update(cx, |room, cx| {- if room.is_muted() {+ if room.is_muted(cx) {ActiveCall::report_call_event_for_room("enable microphone", room.id(), &client, cx);} else {ActiveCall::report_call_event_for_room(