Link signups to users in telemetry via a stored device_id
Co-authored-by: Joseph Lyons <joseph@zed.dev>
This commit is contained in:
parent
04baccbea6
commit
4784dbe498
7 changed files with 124 additions and 109 deletions
|
@ -957,7 +957,7 @@ async fn test_invite_codes() {
|
|||
.create_invite_from_code(&invite_code, "u2@example.com")
|
||||
.await
|
||||
.unwrap();
|
||||
let (user2, inviter) = db
|
||||
let (user2, inviter, _) = db
|
||||
.create_user_from_invite(
|
||||
&user2_invite,
|
||||
NewUserParams {
|
||||
|
@ -1007,7 +1007,7 @@ async fn test_invite_codes() {
|
|||
.create_invite_from_code(&invite_code, "u3@example.com")
|
||||
.await
|
||||
.unwrap();
|
||||
let (user3, inviter) = db
|
||||
let (user3, inviter, _) = db
|
||||
.create_user_from_invite(
|
||||
&user3_invite,
|
||||
NewUserParams {
|
||||
|
@ -1072,7 +1072,7 @@ async fn test_invite_codes() {
|
|||
.create_invite_from_code(&invite_code, "u4@example.com")
|
||||
.await
|
||||
.unwrap();
|
||||
let (user4, _) = db
|
||||
let (user4, _, _) = db
|
||||
.create_user_from_invite(
|
||||
&user4_invite,
|
||||
NewUserParams {
|
||||
|
@ -1139,20 +1139,18 @@ async fn test_signups() {
|
|||
let db = postgres.db();
|
||||
|
||||
// people sign up on the waitlist
|
||||
let mut signup_metric_ids = Vec::new();
|
||||
for i in 0..8 {
|
||||
signup_metric_ids.push(
|
||||
db.create_signup(Signup {
|
||||
email_address: format!("person-{i}@example.com"),
|
||||
platform_mac: true,
|
||||
platform_linux: i % 2 == 0,
|
||||
platform_windows: i % 4 == 0,
|
||||
editor_features: vec!["speed".into()],
|
||||
programming_languages: vec!["rust".into(), "c".into()],
|
||||
})
|
||||
.await
|
||||
.unwrap(),
|
||||
);
|
||||
db.create_signup(Signup {
|
||||
email_address: format!("person-{i}@example.com"),
|
||||
platform_mac: true,
|
||||
platform_linux: i % 2 == 0,
|
||||
platform_windows: i % 4 == 0,
|
||||
editor_features: vec!["speed".into()],
|
||||
programming_languages: vec!["rust".into(), "c".into()],
|
||||
device_id: format!("device_id_{i}"),
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
assert_eq!(
|
||||
|
@ -1219,7 +1217,7 @@ async fn test_signups() {
|
|||
|
||||
// user completes the signup process by providing their
|
||||
// github account.
|
||||
let (user_id, inviter_id) = db
|
||||
let (user_id, inviter_id, signup_device_id) = db
|
||||
.create_user_from_invite(
|
||||
&Invite {
|
||||
email_address: signups_batch1[0].email_address.clone(),
|
||||
|
@ -1238,7 +1236,7 @@ async fn test_signups() {
|
|||
assert_eq!(user.github_login, "person-0");
|
||||
assert_eq!(user.email_address.as_deref(), Some("person-0@example.com"));
|
||||
assert_eq!(user.invite_count, 5);
|
||||
assert_eq!(user.metrics_id, signup_metric_ids[0]);
|
||||
assert_eq!(signup_device_id, "device_id_0");
|
||||
|
||||
// cannot redeem the same signup again.
|
||||
db.create_user_from_invite(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue