Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
proto: Remove `GetPrivateUserInfo` message (#36265)
Marshall Bowersbd1fda678293
diff --git a/crates/client/src/test.rs b/crates/client/src/test.rsindex 439fb100d22..3c451fcb015 100644--- a/crates/client/src/test.rs+++ b/crates/client/src/test.rs@@ -1,16 +1,12 @@use crate::{Client, Connection, Credentials, EstablishConnectionError, UserStore};use anyhow::{Context as _, Result, anyhow};-use chrono::Duration;use cloud_api_client::{AuthenticatedUser, GetAuthenticatedUserResponse, PlanInfo};use cloud_llm_client::{CurrentUsage, Plan, UsageData, UsageLimit};use futures::{StreamExt, stream::BoxStream};use gpui::{AppContext as _, BackgroundExecutor, Entity, TestAppContext};use http_client::{AsyncBody, Method, Request, http};use parking_lot::Mutex;-use rpc::{- ConnectionId, Peer, Receipt, TypedEnvelope,- proto::{self, GetPrivateUserInfo, GetPrivateUserInfoResponse},-};+use rpc::{ConnectionId, Peer, Receipt, TypedEnvelope, proto};use std::sync::Arc;pub struct FakeServer {@@ -187,50 +183,27 @@ impl FakeServer {pub async fn receive<M: proto::EnvelopedMessage>(&self) -> Result<TypedEnvelope<M>> {self.executor.start_waiting();- loop {- let message = self- .state- .lock()- .incoming- .as_mut()- .expect("not connected")- .next()- .await- .context("other half hung up")?;- self.executor.finish_waiting();- let type_name = message.payload_type_name();- let message = message.into_any();-- if message.is::<TypedEnvelope<M>>() {- return Ok(*message.downcast().unwrap());- }-- let accepted_tos_at = chrono::Utc::now()- .checked_sub_signed(Duration::hours(5))- .expect("failed to build accepted_tos_at")- .timestamp() as u64;-- if message.is::<TypedEnvelope<GetPrivateUserInfo>>() {- self.respond(- message- .downcast::<TypedEnvelope<GetPrivateUserInfo>>()- .unwrap()- .receipt(),- GetPrivateUserInfoResponse {- metrics_id: "the-metrics-id".into(),- staff: false,- flags: Default::default(),- accepted_tos_at: Some(accepted_tos_at),- },- );- continue;- }+ let message = self+ .state+ .lock()+ .incoming+ .as_mut()+ .expect("not connected")+ .next()+ .await+ .context("other half hung up")?;+ self.executor.finish_waiting();+ let type_name = message.payload_type_name();+ let message = message.into_any();- panic!(- "fake server received unexpected message type: {:?}",- type_name- );+ if message.is::<TypedEnvelope<M>>() {+ return Ok(*message.downcast().unwrap());}++ panic!(+ "fake server received unexpected message type: {:?}",+ type_name+ );}pub fn respond<T: proto::RequestMessage>(&self, receipt: Receipt<T>, response: T::Response) {diff --git a/crates/collab/src/rpc.rs b/crates/collab/src/rpc.rsindex 715ff4e67d8..8366b2cf136 100644--- a/crates/collab/src/rpc.rs+++ b/crates/collab/src/rpc.rs@@ -462,7 +462,6 @@ impl Server {.add_request_handler(follow).add_message_handler(unfollow).add_message_handler(update_followers)- .add_request_handler(get_private_user_info).add_request_handler(accept_terms_of_service).add_message_handler(acknowledge_channel_message).add_message_handler(acknowledge_buffer_version)@@ -4209,30 +4208,6 @@ async fn mark_notification_as_read(Ok(())}-/// Get the current users information-async fn get_private_user_info(- _request: proto::GetPrivateUserInfo,- response: Response<proto::GetPrivateUserInfo>,- session: MessageContext,-) -> Result<()> {- let db = session.db().await;-- let metrics_id = db.get_user_metrics_id(session.user_id()).await?;- let user = db- .get_user_by_id(session.user_id())- .await?- .context("user not found")?;- let flags = db.get_user_flags(session.user_id()).await?;-- response.send(proto::GetPrivateUserInfoResponse {- metrics_id,- staff: user.admin,- flags,- accepted_tos_at: user.accepted_tos_at.map(|t| t.and_utc().timestamp() as u64),- })?;- Ok(())-}-/// Accept the terms of service (tos) on behalf of the current userasync fn accept_terms_of_service(_request: proto::AcceptTermsOfService,diff --git a/crates/proto/proto/app.proto b/crates/proto/proto/app.protoindex 353f19adb2e..66baf968e3c 100644--- a/crates/proto/proto/app.proto+++ b/crates/proto/proto/app.proto@@ -6,15 +6,6 @@ message UpdateInviteInfo {uint32 count = 2;}-message GetPrivateUserInfo {}--message GetPrivateUserInfoResponse {- string metrics_id = 1;- bool staff = 2;- repeated string flags = 3;- optional uint64 accepted_tos_at = 4;-}-enum Plan {Free = 0;ZedPro = 1;diff --git a/crates/proto/proto/zed.proto b/crates/proto/proto/zed.protoindex 7e7bd6b42b8..8984df29443 100644--- a/crates/proto/proto/zed.proto+++ b/crates/proto/proto/zed.proto@@ -135,8 +135,6 @@ message Envelope {FollowResponse follow_response = 99;UpdateFollowers update_followers = 100;Unfollow unfollow = 101;- GetPrivateUserInfo get_private_user_info = 102;- GetPrivateUserInfoResponse get_private_user_info_response = 103;UpdateUserPlan update_user_plan = 234;UpdateDiffBases update_diff_bases = 104;AcceptTermsOfService accept_terms_of_service = 239;@@ -402,6 +400,7 @@ message Envelope {}reserved 87 to 88;+ reserved 102 to 103;reserved 158 to 161;reserved 164;reserved 166 to 169;diff --git a/crates/proto/src/proto.rs b/crates/proto/src/proto.rsindex 8be9fed172c..82bd1af6dbc 100644--- a/crates/proto/src/proto.rs+++ b/crates/proto/src/proto.rs@@ -105,8 +105,6 @@ messages!((GetPathMetadataResponse, Background),(GetPermalinkToLine, Foreground),(GetPermalinkToLineResponse, Foreground),- (GetPrivateUserInfo, Foreground),- (GetPrivateUserInfoResponse, Foreground),(GetProjectSymbols, Background),(GetProjectSymbolsResponse, Background),(GetReferences, Background),@@ -352,7 +350,6 @@ request_messages!((GetDocumentSymbols, GetDocumentSymbolsResponse),(GetHover, GetHoverResponse),(GetNotifications, GetNotificationsResponse),- (GetPrivateUserInfo, GetPrivateUserInfoResponse),(GetProjectSymbols, GetProjectSymbolsResponse),(GetReferences, GetReferencesResponse),(GetSignatureHelp, GetSignatureHelpResponse),