Refine play type integration flow and docs
This commit is contained in:
@@ -454,6 +454,10 @@ fn export_auth_store_snapshot_from_tables_tx(
|
||||
.meta_id()
|
||||
.find(&AUTH_STORE_PROJECTION_META_ID.to_string())
|
||||
.map(|row| row.updated_at.to_micros_since_unix_epoch());
|
||||
let valid_user_ids = users
|
||||
.iter()
|
||||
.map(|user| user.user_id.clone())
|
||||
.collect::<std::collections::HashSet<_>>();
|
||||
|
||||
let mut phone_identity_by_user_id = std::collections::HashMap::new();
|
||||
let mut phone_to_user_id = std::collections::HashMap::new();
|
||||
@@ -461,6 +465,10 @@ fn export_auth_store_snapshot_from_tables_tx(
|
||||
let mut user_id_by_provider_union_id = std::collections::HashMap::new();
|
||||
|
||||
for identity in identities {
|
||||
if !valid_user_ids.contains(&identity.user_id) {
|
||||
continue;
|
||||
}
|
||||
|
||||
match identity.provider.as_str() {
|
||||
"phone" => {
|
||||
let phone_number = identity
|
||||
@@ -529,6 +537,10 @@ fn export_auth_store_snapshot_from_tables_tx(
|
||||
let mut sessions_by_id = std::collections::HashMap::new();
|
||||
let mut session_id_by_refresh_token_hash = std::collections::HashMap::new();
|
||||
for session in sessions {
|
||||
if !valid_user_ids.contains(&session.user_id) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let client_info = serde_json::from_str::<serde_json::Value>(&session.client_info_json)
|
||||
.map_err(|error| format!("refresh session 客户端信息 JSON 解析失败:{error}"))?;
|
||||
session_id_by_refresh_token_hash.insert(
|
||||
@@ -693,10 +705,9 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn auth_store_snapshot_user_row_key_is_stable_after_username_change() {
|
||||
let mut before = sample_snapshot();
|
||||
let before = sample_snapshot();
|
||||
let mut after = sample_snapshot();
|
||||
after.users_by_username.clear();
|
||||
let mut renamed_user = before
|
||||
let mut renamed_user = after
|
||||
.users_by_username
|
||||
.remove("phone_42")
|
||||
.expect("sample user exists");
|
||||
|
||||
@@ -5521,6 +5521,7 @@ mod tests {
|
||||
deleted_at: None,
|
||||
created_at: Timestamp::from_micros_since_unix_epoch(1),
|
||||
updated_at: Timestamp::from_micros_since_unix_epoch(1),
|
||||
visible: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1415,6 +1415,7 @@ mod tests {
|
||||
height: 1536,
|
||||
})),
|
||||
back_button_asset_json: None,
|
||||
visible: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user