diff --git a/crates/client/src/user.rs b/crates/client/src/user.rs index 37f0f3ec278d28279e8d75f5c0b64c75f69901bb..1cf682d2059a9ee29f2782ab10412ccfbe387e22 100644 --- a/crates/client/src/user.rs +++ b/crates/client/src/user.rs @@ -116,7 +116,6 @@ pub struct UserStore { incoming_contact_requests: Vec>, outgoing_contact_requests: Vec>, pending_contact_requests: HashMap, - invite_info: Option, client: Weak, _maintain_contacts: Task<()>, _maintain_current_user: Task>, @@ -173,7 +172,6 @@ impl UserStore { let (update_contacts_tx, mut update_contacts_rx) = mpsc::unbounded(); let rpc_subscriptions = vec![ client.add_message_handler(cx.weak_entity(), Self::handle_update_contacts), - client.add_message_handler(cx.weak_entity(), Self::handle_update_invite_info), client.add_message_handler(cx.weak_entity(), Self::handle_show_contacts), ]; @@ -193,7 +191,6 @@ impl UserStore { incoming_contact_requests: Default::default(), participant_indices: Default::default(), outgoing_contact_requests: Default::default(), - invite_info: None, client: Arc::downgrade(&client), update_contacts_tx, _maintain_contacts: cx.spawn(async move |this, cx| { @@ -297,21 +294,6 @@ impl UserStore { self.by_github_login.clear(); } - async fn handle_update_invite_info( - this: Entity, - message: TypedEnvelope, - mut cx: AsyncApp, - ) -> Result<()> { - this.update(&mut cx, |this, cx| { - this.invite_info = Some(InviteInfo { - url: Arc::from(message.payload.url), - count: message.payload.count, - }); - cx.notify(); - })?; - Ok(()) - } - async fn handle_show_contacts( this: Entity, _: TypedEnvelope, @@ -321,10 +303,6 @@ impl UserStore { Ok(()) } - pub fn invite_info(&self) -> Option<&InviteInfo> { - self.invite_info.as_ref() - } - async fn handle_update_contacts( this: Entity, message: TypedEnvelope, diff --git a/crates/collab/src/db/queries/users.rs b/crates/collab/src/db/queries/users.rs index 79b5d227c0c6f69476e5968e080d268dd20e879a..2e04e27fdcbe3ae507a58c06acd8db2f79507eb1 100644 --- a/crates/collab/src/db/queries/users.rs +++ b/crates/collab/src/db/queries/users.rs @@ -136,8 +136,6 @@ impl Database { github_user_id: ActiveValue::set(github_user_id), github_user_created_at: ActiveValue::set(Some(github_user_created_at)), admin: ActiveValue::set(false), - invite_count: ActiveValue::set(0), - invite_code: ActiveValue::set(None), metrics_id: ActiveValue::set(Uuid::new_v4()), ..Default::default() }) diff --git a/crates/collab/src/db/tables/user.rs b/crates/collab/src/db/tables/user.rs index 7e86e8f79a07cbc7269734be4ae75c5de8c4d7c5..6807ad4cf1597ad525954e111eae22cd55261ab1 100644 --- a/crates/collab/src/db/tables/user.rs +++ b/crates/collab/src/db/tables/user.rs @@ -15,8 +15,6 @@ pub struct Model { pub email_address: Option, pub name: Option, pub admin: bool, - pub invite_code: Option, - pub invite_count: i32, pub connected_once: bool, pub metrics_id: Uuid, pub created_at: NaiveDateTime, diff --git a/crates/collab/src/rpc.rs b/crates/collab/src/rpc.rs index 5350f3a952f2243f0b6b902d8057b53e792dae01..8fe0da160aaa1199af895ac648b21d91880eecb0 100644 --- a/crates/collab/src/rpc.rs +++ b/crates/collab/src/rpc.rs @@ -982,57 +982,6 @@ impl Server { Ok(()) } - pub async fn invite_code_redeemed( - self: &Arc, - inviter_id: UserId, - invitee_id: UserId, - ) -> Result<()> { - if let Some(user) = self.app_state.db.get_user_by_id(inviter_id).await? - && let Some(code) = &user.invite_code - { - let pool = self.connection_pool.lock(); - let invitee_contact = contact_for_user(invitee_id, false, &pool); - for connection_id in pool.user_connection_ids(inviter_id) { - self.peer.send( - connection_id, - proto::UpdateContacts { - contacts: vec![invitee_contact.clone()], - ..Default::default() - }, - )?; - self.peer.send( - connection_id, - proto::UpdateInviteInfo { - url: format!("{}{}", self.app_state.config.invite_link_prefix, &code), - count: user.invite_count as u32, - }, - )?; - } - } - Ok(()) - } - - pub async fn invite_count_updated(self: &Arc, user_id: UserId) -> Result<()> { - if let Some(user) = self.app_state.db.get_user_by_id(user_id).await? - && let Some(invite_code) = &user.invite_code - { - let pool = self.connection_pool.lock(); - for connection_id in pool.user_connection_ids(user_id) { - self.peer.send( - connection_id, - proto::UpdateInviteInfo { - url: format!( - "{}{}", - self.app_state.config.invite_link_prefix, invite_code - ), - count: user.invite_count as u32, - }, - )?; - } - } - Ok(()) - } - pub async fn snapshot(self: &Arc) -> ServerSnapshot<'_> { ServerSnapshot { connection_pool: ConnectionPoolGuard { diff --git a/crates/proto/proto/app.proto b/crates/proto/proto/app.proto index 3244057194c28d5aa3812c82d419b3a8ae8bf7f2..f98b6775876f94f3516cce587a0a6978eaede2be 100644 --- a/crates/proto/proto/app.proto +++ b/crates/proto/proto/app.proto @@ -1,11 +1,6 @@ syntax = "proto3"; package zed.messages; -message UpdateInviteInfo { - string url = 1; - uint32 count = 2; -} - message ShutdownRemoteServer {} message Toast { diff --git a/crates/proto/proto/zed.proto b/crates/proto/proto/zed.proto index 5c4b2c38e0188dff4fad0cdbd9bd4073009b00d5..960c86c00aa85d8556db212ff65d1a2c9048e754 100644 --- a/crates/proto/proto/zed.proto +++ b/crates/proto/proto/zed.proto @@ -122,7 +122,6 @@ message Envelope { PerformRenameResponse perform_rename_response = 86; UpdateContacts update_contacts = 89; - UpdateInviteInfo update_invite_info = 90; ShowContacts show_contacts = 91; GetUsers get_users = 92; @@ -452,6 +451,7 @@ message Envelope { } reserved 87 to 88, 396; + reserved 90; reserved 102 to 103; reserved 158 to 161; reserved 164; diff --git a/crates/proto/src/proto.rs b/crates/proto/src/proto.rs index 49147a87b99c325cc90ce41be7f65d3ed357a61a..c45667884d8839ca08843eb9834f74c46cf6669f 100644 --- a/crates/proto/src/proto.rs +++ b/crates/proto/src/proto.rs @@ -274,7 +274,6 @@ messages!( (UpdateDiffBases, Foreground), (UpdateFollowers, Foreground), (UpdateGitBranch, Background), - (UpdateInviteInfo, Foreground), (UpdateLanguageServer, Foreground), (UpdateNotification, Foreground), (UpdateParticipantLocation, Foreground),