Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

cloud_api_types: Add new ID fields to `AuthenticatedUser` (#60497)

Marshall Bowers9064f26a454f
diff --git a/crates/client/src/test.rs b/crates/client/src/test.rs
index 858bf499cd5..1770bce2302 100644
--- a/crates/client/src/test.rs
+++ b/crates/client/src/test.rs
@@ -240,7 +240,8 @@ pub fn make_get_authenticated_user_response(
) -> GetAuthenticatedUserResponse {
GetAuthenticatedUserResponse {
user: AuthenticatedUser {
- id: user_id,
+ id_v2: format!("user_{user_id}"),
+ legacy_user_id: user_id,
metrics_id: format!("metrics-id-{user_id}"),
username: username.clone(),
avatar_url: "".to_string(),
diff --git a/crates/cloud_api_types/src/cloud_api_types.rs b/crates/cloud_api_types/src/cloud_api_types.rs
index 0de0a5444d9..b02f5756cce 100644
--- a/crates/cloud_api_types/src/cloud_api_types.rs
+++ b/crates/cloud_api_types/src/cloud_api_types.rs
@@ -36,7 +36,8 @@ pub struct GetAuthenticatedUserResponse {
#[derive(Debug, PartialEq, Serialize, Deserialize)]
pub struct AuthenticatedUser {
- pub id: i32,
+ pub id_v2: String,
+ pub legacy_user_id: i32,
pub metrics_id: String,
pub username: String,
pub avatar_url: String,
diff --git a/crates/collab/src/auth.rs b/crates/collab/src/auth.rs
index 95cb4626b3e..7f0fa5b7a8a 100644
--- a/crates/collab/src/auth.rs
+++ b/crates/collab/src/auth.rs
@@ -67,7 +67,7 @@ pub async fn validate_header<B>(mut req: Request<B>, next: Next<B>) -> impl Into
.context("failed to parse response body")?;
let user = User {
- id: UserId(response_body.user.id),
+ id: UserId(response_body.user.legacy_user_id),
username: response_body.user.username,
github_login: response_body.user.github_login,
avatar_url: response_body.user.avatar_url,