diff --git a/crates/call/src/call.rs b/crates/call/src/call.rs index 5886462ccf..4db298fe98 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, channel_id: Option, client: &Arc, cx: &AppContext, diff --git a/crates/client/src/telemetry.rs b/crates/client/src/telemetry.rs index 9cc5d13af0..f8642dd7fa 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, channel_id: Option, }, } diff --git a/crates/collab_ui/src/collab_panel.rs b/crates/collab_ui/src/collab_panel.rs index d27cdc8acf..fba10c61ba 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) { 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.rs index 04644b62d9..ee34f600fa 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,