From 4d551104522ddfcc1ed4c597ed56ea1f7d3beb13 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 2 Aug 2023 15:45:19 -0700 Subject: [PATCH] Restore seeding of random GH users in seed-db Co-authored-by: Mikayla --- crates/collab/src/bin/seed.rs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/crates/collab/src/bin/seed.rs b/crates/collab/src/bin/seed.rs index 9384e826c0..cb1594e941 100644 --- a/crates/collab/src/bin/seed.rs +++ b/crates/collab/src/bin/seed.rs @@ -64,9 +64,9 @@ async fn main() { .expect("failed to fetch user") .is_none() { - if let Some(email) = &github_user.email { + if admin { db.create_user( - email, + &format!("{}@zed.dev", github_user.login), admin, db::NewUserParams { github_login: github_user.login, @@ -76,15 +76,11 @@ async fn main() { ) .await .expect("failed to insert user"); - } else if admin { - db.create_user( - &format!("{}@zed.dev", github_user.login), - admin, - db::NewUserParams { - github_login: github_user.login, - github_user_id: github_user.id, - invite_count: 5, - }, + } else { + db.get_or_create_user_by_github_account( + &github_user.login, + Some(github_user.id), + github_user.email.as_deref(), ) .await .expect("failed to insert user");