Revert "Add call events (#2704)"

Joseph T. Lyons created

This reverts commit 6c44fc59b76d0d482211599f4f38262898295557.

Change summary

crates/call/src/call.rs                                 | 43 ----------
crates/client/src/telemetry.rs                          |  4 -
crates/collab/src/tests/integration_tests.rs            |  6 
crates/collab/src/tests/randomized_integration_tests.rs |  2 
crates/collab_ui/src/collab_ui.rs                       | 15 ++-
crates/collab_ui/src/incoming_call_notification.rs      |  4 
crates/editor/src/editor.rs                             |  4 
7 files changed, 21 insertions(+), 57 deletions(-)

Detailed changes

crates/call/src/call.rs 🔗

@@ -4,7 +4,7 @@ pub mod room;
 use std::sync::Arc;
 
 use anyhow::{anyhow, Result};
-use client::{proto, ClickhouseEvent, Client, TelemetrySettings, TypedEnvelope, User, UserStore};
+use client::{proto, Client, TypedEnvelope, User, UserStore};
 use collections::HashSet;
 use futures::{future::Shared, FutureExt};
 use postage::watch;
@@ -198,7 +198,6 @@ impl ActiveCall {
             let result = invite.await;
             this.update(&mut cx, |this, cx| {
                 this.pending_invites.remove(&called_user_id);
-                this.report_call_event("invite", cx);
                 cx.notify();
             });
             result
@@ -244,26 +243,21 @@ impl ActiveCall {
         };
 
         let join = Room::join(&call, self.client.clone(), self.user_store.clone(), cx);
-
         cx.spawn(|this, mut cx| async move {
             let room = join.await?;
             this.update(&mut cx, |this, cx| this.set_room(Some(room.clone()), cx))
                 .await?;
-            this.update(&mut cx, |this, cx| {
-                this.report_call_event("accept incoming", cx)
-            });
             Ok(())
         })
     }
 
-    pub fn decline_incoming(&mut self, cx: &mut ModelContext<Self>) -> Result<()> {
+    pub fn decline_incoming(&mut self) -> Result<()> {
         let call = self
             .incoming_call
             .0
             .borrow_mut()
             .take()
             .ok_or_else(|| anyhow!("no incoming call"))?;
-        self.report_call_event_for_room("decline incoming", call.room_id, cx);
         self.client.send(proto::DeclineCall {
             room_id: call.room_id,
         })?;
@@ -272,7 +266,6 @@ impl ActiveCall {
 
     pub fn hang_up(&mut self, cx: &mut ModelContext<Self>) -> Task<Result<()>> {
         cx.notify();
-        self.report_call_event("hang up", cx);
         if let Some((room, _)) = self.room.take() {
             room.update(cx, |room, cx| room.leave(cx))
         } else {
@@ -280,28 +273,12 @@ impl ActiveCall {
         }
     }
 
-    pub fn toggle_screen_sharing(&self, cx: &mut AppContext) {
-        if let Some(room) = self.room().cloned() {
-            let toggle_screen_sharing = room.update(cx, |room, cx| {
-                if room.is_screen_sharing() {
-                    self.report_call_event("disable screen share", cx);
-                    Task::ready(room.unshare_screen(cx))
-                } else {
-                    self.report_call_event("enable screen share", cx);
-                    room.share_screen(cx)
-                }
-            });
-            toggle_screen_sharing.detach_and_log_err(cx);
-        }
-    }
-
     pub fn share_project(
         &mut self,
         project: ModelHandle<Project>,
         cx: &mut ModelContext<Self>,
     ) -> Task<Result<u64>> {
         if let Some((room, _)) = self.room.as_ref() {
-            self.report_call_event("share project", cx);
             room.update(cx, |room, cx| room.share_project(project, cx))
         } else {
             Task::ready(Err(anyhow!("no active call")))
@@ -314,7 +291,6 @@ impl ActiveCall {
         cx: &mut ModelContext<Self>,
     ) -> Result<()> {
         if let Some((room, _)) = self.room.as_ref() {
-            self.report_call_event("unshare project", cx);
             room.update(cx, |room, cx| room.unshare_project(project, cx))
         } else {
             Err(anyhow!("no active call"))
@@ -376,19 +352,4 @@ impl ActiveCall {
     pub fn pending_invites(&self) -> &HashSet<u64> {
         &self.pending_invites
     }
-
-    fn report_call_event(&self, operation: &'static str, cx: &AppContext) {
-        if let Some(room) = self.room() {
-            self.report_call_event_for_room(operation, room.read(cx).id(), cx)
-        }
-    }
-
-    fn report_call_event_for_room(&self, operation: &'static str, room_id: u64, cx: &AppContext) {
-        let telemetry = self.client.telemetry();
-        let telemetry_settings = *settings::get::<TelemetrySettings>(cx);
-
-        let event = ClickhouseEvent::Call { operation, room_id };
-
-        telemetry.report_clickhouse_event(event, telemetry_settings);
-    }
 }

crates/client/src/telemetry.rs 🔗

@@ -70,10 +70,6 @@ pub enum ClickhouseEvent {
         suggestion_accepted: bool,
         file_extension: Option<String>,
     },
-    Call {
-        operation: &'static str,
-        room_id: u64,
-    },
 }
 
 #[cfg(debug_assertions)]

crates/collab/src/tests/integration_tests.rs 🔗

@@ -157,7 +157,7 @@ async fn test_basic_calls(
     // User C receives the call, but declines it.
     let call_c = incoming_call_c.next().await.unwrap().unwrap();
     assert_eq!(call_c.calling_user.github_login, "user_b");
-    active_call_c.update(cx_c, |call, cx| call.decline_incoming(cx).unwrap());
+    active_call_c.update(cx_c, |call, _| call.decline_incoming().unwrap());
     assert!(incoming_call_c.next().await.unwrap().is_none());
 
     deterministic.run_until_parked();
@@ -1080,7 +1080,7 @@ async fn test_calls_on_multiple_connections(
 
     // User B declines the call on one of the two connections, causing both connections
     // to stop ringing.
-    active_call_b2.update(cx_b2, |call, cx| call.decline_incoming(cx).unwrap());
+    active_call_b2.update(cx_b2, |call, _| call.decline_incoming().unwrap());
     deterministic.run_until_parked();
     assert!(incoming_call_b1.next().await.unwrap().is_none());
     assert!(incoming_call_b2.next().await.unwrap().is_none());
@@ -5945,7 +5945,7 @@ async fn test_contacts(
         [("user_b".to_string(), "online", "busy")]
     );
 
-    active_call_b.update(cx_b, |call, cx| call.decline_incoming(cx).unwrap());
+    active_call_b.update(cx_b, |call, _| call.decline_incoming().unwrap());
     deterministic.run_until_parked();
     assert_eq!(
         contacts(&client_a, cx_a),

crates/collab/src/tests/randomized_integration_tests.rs 🔗

@@ -365,7 +365,7 @@ async fn apply_client_operation(
             }
 
             log::info!("{}: declining incoming call", client.username);
-            active_call.update(cx, |call, cx| call.decline_incoming(cx))?;
+            active_call.update(cx, |call, _| call.decline_incoming())?;
         }
 
         ClientOperation::LeaveCall => {

crates/collab_ui/src/collab_ui.rs 🔗

@@ -12,7 +12,7 @@ mod sharing_status_indicator;
 
 use call::{ActiveCall, Room};
 pub use collab_titlebar_item::{CollabTitlebarItem, ToggleContactsMenu};
-use gpui::{actions, AppContext};
+use gpui::{actions, AppContext, Task};
 use std::sync::Arc;
 use util::ResultExt;
 use workspace::AppState;
@@ -45,9 +45,16 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut AppContext) {
 }
 
 pub fn toggle_screen_sharing(_: &ToggleScreenSharing, cx: &mut AppContext) {
-    ActiveCall::global(cx).update(cx, |call, cx| {
-        call.toggle_screen_sharing(cx);
-    });
+    if let Some(room) = ActiveCall::global(cx).read(cx).room().cloned() {
+        let toggle_screen_sharing = room.update(cx, |room, cx| {
+            if room.is_screen_sharing() {
+                Task::ready(room.unshare_screen(cx))
+            } else {
+                room.share_screen(cx)
+            }
+        });
+        toggle_screen_sharing.detach_and_log_err(cx);
+    }
 }
 
 pub fn toggle_mute(_: &ToggleMute, cx: &mut AppContext) {

crates/collab_ui/src/incoming_call_notification.rs 🔗

@@ -99,8 +99,8 @@ impl IncomingCallNotification {
                 })
                 .detach_and_log_err(cx);
         } else {
-            active_call.update(cx, |active_call, cx| {
-                active_call.decline_incoming(cx).log_err();
+            active_call.update(cx, |active_call, _| {
+                active_call.decline_incoming().log_err();
             });
         }
     }

crates/editor/src/editor.rs 🔗

@@ -7518,7 +7518,7 @@ impl Editor {
 
     fn report_editor_event(
         &self,
-        operation: &'static str,
+        name: &'static str,
         file_extension: Option<String>,
         cx: &AppContext,
     ) {
@@ -7555,7 +7555,7 @@ impl Editor {
         let event = ClickhouseEvent::Editor {
             file_extension,
             vim_mode,
-            operation,
+            operation: name,
             copilot_enabled,
             copilot_enabled_for_language,
         };