collab: Only access github_user_id and github_login columns in tests (#58457)
This PR marks the `github_user_id` and `github_login` columns on the `User` database model as only being accessible in tests. Closes CLO-829. Release Notes: - N/A
This commit is contained in:
1 parent
0cd94e0def
commit
c4cb8aef59
3 files changed
+7
-6
No files matched your search
@@ -64,11 +64,10 @@ impl Database {
|
||||
return Ok(None);
|
||||
};
|
||||
|
||||
let user = user::Entity::find_by_id(thread.user_id).one(&*tx).await?;
|
||||
|
||||
let username = user
|
||||
.map(|u| u.github_login)
|
||||
.unwrap_or_else(|| "Unknown".to_string());
|
||||
// We can no longer read the `github_login` from Collab.
|
||||
//
|
||||
// Opting to just use "Unknown" here, as the feature is staff-only and infrequently used.
|
||||
let username = "Unknown".to_string();
|
||||
|
||||
Ok(Some((thread, username)))
|
||||
})
|
||||
|
||||
@@ -8,7 +8,9 @@ use serde::Serialize;
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
pub id: UserId,
|
||||
#[cfg(feature = "test-support")]
|
||||
pub github_login: String,
|
||||
#[cfg(feature = "test-support")]
|
||||
pub github_user_id: i32,
|
||||
pub admin: bool,
|
||||
pub connected_once: bool,
|
||||
|
||||
@@ -285,7 +285,7 @@ async fn test_upsert_shared_thread(db: &Arc<Database>) {
|
||||
assert_eq!(thread.title, title);
|
||||
assert_eq!(thread.data, data);
|
||||
assert_eq!(thread.user_id, user_id);
|
||||
assert_eq!(username, "user1");
|
||||
assert_eq!(username, "Unknown");
|
||||
}
|
||||
|
||||
test_both_dbs!(
|
||||
|
||||
Reference in new issue
Block a user