mirror of
https://github.com/modrinth/code.git
synced 2026-08-24 16:44:51 +00:00
feat: more details linked account info for support/moderation (#6897)
* feat: show discord + steam ID + github profile in "Show details" user modal * pnpm intl:extract
This commit is contained in:
@@ -24,7 +24,6 @@ pub struct LegacyUser {
|
||||
pub has_totp: Option<bool>,
|
||||
pub payout_data: Option<UserPayoutData>, // this was changed in v3, but not ones we want to keep out of v2
|
||||
|
||||
// DEPRECATED. Always returns None
|
||||
pub github_id: Option<u64>,
|
||||
}
|
||||
|
||||
|
||||
@@ -70,8 +70,11 @@ pub struct User {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub moderation_notes: Option<Option<ModerationNote>>,
|
||||
|
||||
// DEPRECATED. Always returns None
|
||||
pub github_id: Option<u64>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub discord_id: Option<String>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub steam_id: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, utoipa::ToSchema)]
|
||||
@@ -119,6 +122,8 @@ impl From<DBUser> for User {
|
||||
has_password: None,
|
||||
has_totp: None,
|
||||
github_id: None,
|
||||
discord_id: None,
|
||||
steam_id: None,
|
||||
stripe_customer_id: None,
|
||||
allow_friend_requests: None,
|
||||
eligibility_verified_at: None,
|
||||
@@ -180,6 +185,8 @@ impl User {
|
||||
has_password: Some(db_user.password.is_some()),
|
||||
has_totp: Some(db_user.totp_secret.is_some()),
|
||||
github_id: None,
|
||||
discord_id: None,
|
||||
steam_id: None,
|
||||
payout_data: Some(UserPayoutData {
|
||||
paypal_address: db_user.paypal_email,
|
||||
paypal_country: db_user.paypal_country,
|
||||
|
||||
@@ -481,7 +481,15 @@ pub async fn user_get(
|
||||
let user_id = data.id;
|
||||
|
||||
let mut response: crate::models::users::User = if is_admin {
|
||||
crate::models::users::User::from_full(data)
|
||||
let github_id =
|
||||
data.github_id.and_then(|id| u64::try_from(id).ok());
|
||||
let discord_id = data.discord_id.map(|id| id.to_string());
|
||||
let steam_id = data.steam_id.map(|id| id.to_string());
|
||||
let mut user = crate::models::users::User::from_full(data);
|
||||
user.github_id = github_id;
|
||||
user.discord_id = discord_id;
|
||||
user.steam_id = steam_id;
|
||||
user
|
||||
} else {
|
||||
data.into()
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user