From 1fd72d26cbc6f896f4a043c98a72b3ed2b7fefd7 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 23 Jan 2024 11:31:55 -0800 Subject: [PATCH] Exclude staff from CLA check --- crates/collab/src/db/queries/contributors.rs | 21 ++++++++++++-------- crates/collab/src/db/tables/user.rs | 1 + 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/crates/collab/src/db/queries/contributors.rs b/crates/collab/src/db/queries/contributors.rs index 418e5dd1e1..0972779ce9 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 5ab7f17a01..5c9166adab 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, pub connected_once: bool, pub metrics_id: Uuid, + pub created_at: DateTime, } #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]