Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Ensure that subsequent signup happens after initial
Joseph Lyonsd71d543337ab
diff --git a/crates/collab/src/db/signup.rs b/crates/collab/src/db/signup.rsindex 5d5a9a1b611..6368482de93 100644--- a/crates/collab/src/db/signup.rs+++ b/crates/collab/src/db/signup.rs@@ -44,6 +44,7 @@ pub struct NewSignup {pub programming_languages: Vec<String>,pub device_id: Option<String>,pub added_to_mailing_list: bool,+ pub created_at: Option<DateTime>,}#[derive(Clone, Debug, PartialEq, Deserialize, Serialize, FromQueryResult)]diff --git a/crates/collab/src/db/tests.rs b/crates/collab/src/db/tests.rsindex 84cf4229762..e3819116a04 100644--- a/crates/collab/src/db/tests.rs+++ b/crates/collab/src/db/tests.rs@@ -737,6 +737,8 @@ async fn test_multiple_signup_overwrite() {let email_address = "[email protected]".to_string();+ let initial_signup_created_at_milliseconds = 0;+let initial_signup = NewSignup {email_address: email_address.clone(),platform_mac: false,@@ -746,6 +748,9 @@ async fn test_multiple_signup_overwrite() {programming_languages: vec!["rust".into(), "c".into()],device_id: Some(format!("device_id")),added_to_mailing_list: false,+ created_at: Some(+ DateTime::from_timestamp_millis(initial_signup_created_at_milliseconds).unwrap(),+ ),};db.create_signup(&initial_signup).await.unwrap();@@ -775,6 +780,13 @@ async fn test_multiple_signup_overwrite() {programming_languages: vec!["d".into(), "elm".into()],device_id: Some(format!("different_device_id")),added_to_mailing_list: true,+ // subsequent signup happens next day+ created_at: Some(+ DateTime::from_timestamp_millis(+ initial_signup_created_at_milliseconds + (1000 * 60 * 60 * 24),+ )+ .unwrap(),+ ),};db.create_signup(&subsequent_signup).await.unwrap();@@ -817,6 +829,7 @@ async fn test_signups() {programming_languages: vec!["rust".into(), "c".into()],device_id: Some(format!("device_id_{i}")),added_to_mailing_list: i != 0, // One user failed to subscribe+ created_at: Some(DateTime::from_timestamp_millis(i as i64).unwrap()), // Signups are consecutive}).collect::<Vec<NewSignup>>();