mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-09 20:04:25 +00:00
Exclude staff from CLA check (#4225)
This commit is contained in:
commit
67b7d74908
4 changed files with 50 additions and 46 deletions
|
@ -7,7 +7,7 @@ CREATE TABLE "users" (
|
||||||
"invite_count" INTEGER NOT NULL DEFAULT 0,
|
"invite_count" INTEGER NOT NULL DEFAULT 0,
|
||||||
"inviter_id" INTEGER REFERENCES users (id),
|
"inviter_id" INTEGER REFERENCES users (id),
|
||||||
"connected_once" BOOLEAN NOT NULL DEFAULT false,
|
"connected_once" BOOLEAN NOT NULL DEFAULT false,
|
||||||
"created_at" TIMESTAMP NOT NULL DEFAULT now,
|
"created_at" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
"metrics_id" TEXT,
|
"metrics_id" TEXT,
|
||||||
"github_user_id" INTEGER
|
"github_user_id" INTEGER
|
||||||
);
|
);
|
||||||
|
|
|
@ -42,14 +42,19 @@ impl Database {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let Some(user) = user::Entity::find().filter(condition).one(&*tx).await? else {
|
if let Some(user) = user::Entity::find().filter(condition).one(&*tx).await? {
|
||||||
return Ok(None);
|
if user.admin {
|
||||||
};
|
return Ok(Some(user.created_at));
|
||||||
let Some(contributor) = contributor::Entity::find_by_id(user.id).one(&*tx).await?
|
}
|
||||||
else {
|
|
||||||
return Ok(None);
|
if let Some(contributor) =
|
||||||
};
|
contributor::Entity::find_by_id(user.id).one(&*tx).await?
|
||||||
Ok(Some(contributor.signed_at))
|
{
|
||||||
|
return Ok(Some(contributor.signed_at));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(None)
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ pub struct Model {
|
||||||
pub inviter_id: Option<UserId>,
|
pub inviter_id: Option<UserId>,
|
||||||
pub connected_once: bool,
|
pub connected_once: bool,
|
||||||
pub metrics_id: Uuid,
|
pub metrics_id: Uuid,
|
||||||
|
pub created_at: DateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||||
|
|
|
@ -31,44 +31,42 @@ async fn test_get_users(db: &Arc<Database>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
db.get_users_by_ids(user_ids.clone()).await.unwrap(),
|
db.get_users_by_ids(user_ids.clone())
|
||||||
|
.await
|
||||||
|
.unwrap()
|
||||||
|
.into_iter()
|
||||||
|
.map(|user| (
|
||||||
|
user.id,
|
||||||
|
user.github_login,
|
||||||
|
user.github_user_id,
|
||||||
|
user.email_address
|
||||||
|
))
|
||||||
|
.collect::<Vec<_>>(),
|
||||||
vec![
|
vec![
|
||||||
User {
|
(
|
||||||
id: user_ids[0],
|
user_ids[0],
|
||||||
github_login: "user1".to_string(),
|
"user1".to_string(),
|
||||||
github_user_id: Some(1),
|
Some(1),
|
||||||
email_address: Some("user1@example.com".to_string()),
|
Some("user1@example.com".to_string()),
|
||||||
admin: false,
|
),
|
||||||
metrics_id: user_metric_ids[0].parse().unwrap(),
|
(
|
||||||
..Default::default()
|
user_ids[1],
|
||||||
},
|
"user2".to_string(),
|
||||||
User {
|
Some(2),
|
||||||
id: user_ids[1],
|
Some("user2@example.com".to_string()),
|
||||||
github_login: "user2".to_string(),
|
),
|
||||||
github_user_id: Some(2),
|
(
|
||||||
email_address: Some("user2@example.com".to_string()),
|
user_ids[2],
|
||||||
admin: false,
|
"user3".to_string(),
|
||||||
metrics_id: user_metric_ids[1].parse().unwrap(),
|
Some(3),
|
||||||
..Default::default()
|
Some("user3@example.com".to_string()),
|
||||||
},
|
),
|
||||||
User {
|
(
|
||||||
id: user_ids[2],
|
user_ids[3],
|
||||||
github_login: "user3".to_string(),
|
"user4".to_string(),
|
||||||
github_user_id: Some(3),
|
Some(4),
|
||||||
email_address: Some("user3@example.com".to_string()),
|
Some("user4@example.com".to_string()),
|
||||||
admin: false,
|
)
|
||||||
metrics_id: user_metric_ids[2].parse().unwrap(),
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
User {
|
|
||||||
id: user_ids[3],
|
|
||||||
github_login: "user4".to_string(),
|
|
||||||
github_user_id: Some(4),
|
|
||||||
email_address: Some("user4@example.com".to_string()),
|
|
||||||
admin: false,
|
|
||||||
metrics_id: user_metric_ids[3].parse().unwrap(),
|
|
||||||
..Default::default()
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue