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.

Exclude staff from CLA check

Max Brunsfeld1fd72d26cbc6
diff --git a/crates/collab/src/db/queries/contributors.rs b/crates/collab/src/db/queries/contributors.rs
index 418e5dd1e14..0972779ce95 100644
--- a/crates/collab/src/db/queries/contributors.rs
+++ b/crates/collab/src/db/queries/contributors.rs
@@ -42,14 +42,19 @@ impl Database {
}
};
- let Some(user) = user::Entity::find().filter(condition).one(&*tx).await? else {
- return Ok(None);
- };
- let Some(contributor) = contributor::Entity::find_by_id(user.id).one(&*tx).await?
- else {
- return Ok(None);
- };
- Ok(Some(contributor.signed_at))
+ if let Some(user) = user::Entity::find().filter(condition).one(&*tx).await? {
+ if user.admin {
+ return Ok(Some(user.created_at));
+ }
+
+ if let Some(contributor) =
+ contributor::Entity::find_by_id(user.id).one(&*tx).await?
+ {
+ return Ok(Some(contributor.signed_at));
+ }
+ }
+
+ Ok(None)
})
.await
}
diff --git a/crates/collab/src/db/tables/user.rs b/crates/collab/src/db/tables/user.rs
index 5ab7f17a01e..5c9166adab5 100644
--- a/crates/collab/src/db/tables/user.rs
+++ b/crates/collab/src/db/tables/user.rs
@@ -17,6 +17,7 @@ pub struct Model {
pub inviter_id: Option<UserId>,
pub connected_once: bool,
pub metrics_id: Uuid,
+ pub created_at: DateTime,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]