Expose login address via API only if it's verified

This commit is contained in:
silverpill 2022-05-27 20:52:03 +00:00
parent b9722afebe
commit f9689807e3
2 changed files with 5 additions and 5 deletions

View file

@ -701,6 +701,7 @@ components:
wallet_address:
description: Ethereum wallet address (visibile only to the current user).
type: string
nullable: true
example: '0xd8da6bf...'
Attachment:
type: object

View file

@ -121,9 +121,11 @@ impl Account {
note: user.profile.bio_source.clone(),
fields: fields_sources,
};
// Expose login address only if it's verified
let wallet_address = user.public_wallet_address();
let mut account = Self::from_profile(user.profile, instance_url);
account.source = Some(source);
account.wallet_address = user.wallet_address;
account.wallet_address = wallet_address;
account
}
}
@ -350,9 +352,6 @@ mod tests {
account.source.unwrap().note.unwrap(),
bio_source,
);
assert_eq!(
account.wallet_address.unwrap(),
wallet_address,
);
assert_eq!(account.wallet_address, None);
}
}