Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Allow call events to be logged without a room id
Joseph T. Lyons39e13b667554
diff --git a/crates/call/src/call.rs b/crates/call/src/call.rsindex 5886462ccf8..4db298fe98e 100644--- a/crates/call/src/call.rs+++ b/crates/call/src/call.rs@@ -273,7 +273,13 @@ impl ActiveCall {.borrow_mut().take().ok_or_else(|| anyhow!("no incoming call"))?;- Self::report_call_event_for_room("decline incoming", call.room_id, None, &self.client, cx);+ Self::report_call_event_for_room(+ "decline incoming",+ Some(call.room_id),+ None,+ &self.client,+ cx,+ );self.client.send(proto::DeclineCall {room_id: call.room_id,})?;@@ -403,22 +409,20 @@ impl ActiveCall {&self.pending_invites}- pub fn report_call_event(&self, operation: &'static str, cx: &AppContext) {- if let Some(room) = self.room() {- let room = room.read(cx);- Self::report_call_event_for_room(- operation,- room.id(),- room.channel_id(),- &self.client,- cx,- )- }+ fn report_call_event(&self, operation: &'static str, cx: &AppContext) {+ let (room_id, channel_id) = match self.room() {+ Some(room) => {+ let room = room.read(cx);+ (Some(room.id()), room.channel_id())+ }+ None => (None, None),+ };+ Self::report_call_event_for_room(operation, room_id, channel_id, &self.client, cx)}pub fn report_call_event_for_room(operation: &'static str,- room_id: u64,+ room_id: Option<u64>,channel_id: Option<u64>,client: &Arc<Client>,cx: &AppContext,diff --git a/crates/client/src/telemetry.rs b/crates/client/src/telemetry.rsindex 9cc5d13af0c..f8642dd7fad 100644--- a/crates/client/src/telemetry.rs+++ b/crates/client/src/telemetry.rs@@ -73,7 +73,7 @@ pub enum ClickhouseEvent {},Call {operation: &'static str,- room_id: u64,+ room_id: Option<u64>,channel_id: Option<u64>,},}diff --git a/crates/collab_ui/src/collab_panel.rs b/crates/collab_ui/src/collab_panel.rsindex d27cdc8acf2..fba10c61bad 100644--- a/crates/collab_ui/src/collab_panel.rs+++ b/crates/collab_ui/src/collab_panel.rs@@ -2240,7 +2240,8 @@ impl CollabPanel {fn open_channel_buffer(&mut self, action: &OpenChannelBuffer, cx: &mut ViewContext<Self>) {if let Some(workspace) = self.workspace.upgrade(cx) {let pane = workspace.read(cx).active_pane().clone();- let channel_view = ChannelView::open(action.channel_id, pane.clone(), workspace, cx);+ let channel_id = action.channel_id;+ let channel_view = ChannelView::open(channel_id, pane.clone(), workspace, cx);cx.spawn(|_, mut cx| async move {let channel_view = channel_view.await?;pane.update(&mut cx, |pane, cx| {@@ -2249,9 +2250,18 @@ impl CollabPanel {anyhow::Ok(())}).detach();- ActiveCall::global(cx).update(cx, |call, cx| {- call.report_call_event("open channel notes", cx)- });+ let room_id = ActiveCall::global(cx)+ .read(cx)+ .room()+ .map(|room| room.read(cx).id());++ ActiveCall::report_call_event_for_room(+ "open channel notes",+ room_id,+ Some(channel_id),+ &self.client,+ cx,+ );}}diff --git a/crates/collab_ui/src/collab_ui.rs b/crates/collab_ui/src/collab_ui.rsindex 04644b62d98..ee34f600fa9 100644--- a/crates/collab_ui/src/collab_ui.rs+++ b/crates/collab_ui/src/collab_ui.rs@@ -49,7 +49,7 @@ pub fn toggle_screen_sharing(_: &ToggleScreenSharing, cx: &mut AppContext) {if room.is_screen_sharing() {ActiveCall::report_call_event_for_room("disable screen share",- room.id(),+ Some(room.id()),room.channel_id(),&client,cx,@@ -58,7 +58,7 @@ pub fn toggle_screen_sharing(_: &ToggleScreenSharing, cx: &mut AppContext) {} else {ActiveCall::report_call_event_for_room("enable screen share",- room.id(),+ Some(room.id()),room.channel_id(),&client,cx,@@ -78,7 +78,7 @@ pub fn toggle_mute(_: &ToggleMute, cx: &mut AppContext) {if room.is_muted(cx) {ActiveCall::report_call_event_for_room("enable microphone",- room.id(),+ Some(room.id()),room.channel_id(),&client,cx,@@ -86,7 +86,7 @@ pub fn toggle_mute(_: &ToggleMute, cx: &mut AppContext) {} else {ActiveCall::report_call_event_for_room("disable microphone",- room.id(),+ Some(room.id()),room.channel_id(),&client,cx,