Exclude staff from CLA check

Max Brunsfeld created

Change summary

crates/collab/src/db/queries/contributors.rs | 21 +++++++++++++--------
crates/collab/src/db/tables/user.rs          |  1 +
2 files changed, 14 insertions(+), 8 deletions(-)

Detailed changes

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
     }

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)]