Detailed changes
@@ -116,7 +116,6 @@ pub struct UserStore {
incoming_contact_requests: Vec<Arc<User>>,
outgoing_contact_requests: Vec<Arc<User>>,
pending_contact_requests: HashMap<u64, usize>,
- invite_info: Option<InviteInfo>,
client: Weak<Client>,
_maintain_contacts: Task<()>,
_maintain_current_user: Task<Result<()>>,
@@ -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<Self>,
- message: TypedEnvelope<proto::UpdateInviteInfo>,
- 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<Self>,
_: TypedEnvelope<proto::ShowContacts>,
@@ -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<Self>,
message: TypedEnvelope<proto::UpdateContacts>,
@@ -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()
})
@@ -15,8 +15,6 @@ pub struct Model {
pub email_address: Option<String>,
pub name: Option<String>,
pub admin: bool,
- pub invite_code: Option<String>,
- pub invite_count: i32,
pub connected_once: bool,
pub metrics_id: Uuid,
pub created_at: NaiveDateTime,
@@ -982,57 +982,6 @@ impl Server {
Ok(())
}
- pub async fn invite_code_redeemed(
- self: &Arc<Self>,
- 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<Self>, 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<Self>) -> ServerSnapshot<'_> {
ServerSnapshot {
connection_pool: ConnectionPoolGuard {
@@ -1,11 +1,6 @@
syntax = "proto3";
package zed.messages;
-message UpdateInviteInfo {
- string url = 1;
- uint32 count = 2;
-}
-
message ShutdownRemoteServer {}
message Toast {
@@ -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;
@@ -274,7 +274,6 @@ messages!(
(UpdateDiffBases, Foreground),
(UpdateFollowers, Foreground),
(UpdateGitBranch, Background),
- (UpdateInviteInfo, Foreground),
(UpdateLanguageServer, Foreground),
(UpdateNotification, Foreground),
(UpdateParticipantLocation, Foreground),