Skip to content

Commit c4cb8ae

Browse files
authored
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
1 parent 0cd94e0 commit c4cb8ae

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

crates/collab/src/db/queries/shared_threads.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,10 @@ impl Database {
6464
return Ok(None);
6565
};
6666

67-
let user = user::Entity::find_by_id(thread.user_id).one(&*tx).await?;
68-
69-
let username = user
70-
.map(|u| u.github_login)
71-
.unwrap_or_else(|| "Unknown".to_string());
67+
// We can no longer read the `github_login` from Collab.
68+
//
69+
// Opting to just use "Unknown" here, as the feature is staff-only and infrequently used.
70+
let username = "Unknown".to_string();
7271

7372
Ok(Some((thread, username)))
7473
})

crates/collab/src/db/tables/user.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ use serde::Serialize;
88
pub struct Model {
99
#[sea_orm(primary_key)]
1010
pub id: UserId,
11+
#[cfg(feature = "test-support")]
1112
pub github_login: String,
13+
#[cfg(feature = "test-support")]
1214
pub github_user_id: i32,
1315
pub admin: bool,
1416
pub connected_once: bool,

crates/collab/tests/integration/db_tests/db_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ async fn test_upsert_shared_thread(db: &Arc<Database>) {
285285
assert_eq!(thread.title, title);
286286
assert_eq!(thread.data, data);
287287
assert_eq!(thread.user_id, user_id);
288-
assert_eq!(username, "user1");
288+
assert_eq!(username, "Unknown");
289289
}
290290

291291
test_both_dbs!(

0 commit comments

Comments
 (0)