Build CustomPerson from source string at once
This commit is contained in:
parent
d36f13e984
commit
399af4004a
1 changed files with 1 additions and 14 deletions
|
@ -246,20 +246,7 @@ impl User {
|
||||||
fn fetch(url: &str) -> Result<CustomPerson> {
|
fn fetch(url: &str) -> Result<CustomPerson> {
|
||||||
let res = get(url, Self::get_sender(), CONFIG.proxy().cloned())?;
|
let res = get(url, Self::get_sender(), CONFIG.proxy().cloned())?;
|
||||||
let text = &res.text()?;
|
let text = &res.text()?;
|
||||||
// without this workaround, publicKey is not correctly deserialized
|
let json = serde_json::from_str::<CustomPerson>(text)?;
|
||||||
let ap_sign = serde_json::from_str::<ApSignature>(text)?;
|
|
||||||
let person = serde_json::from_str::<Person>(text)?;
|
|
||||||
let json = CustomPerson::new(
|
|
||||||
ApActor::new(
|
|
||||||
person
|
|
||||||
.clone()
|
|
||||||
.id_unchecked()
|
|
||||||
.ok_or(Error::MissingApProperty)?
|
|
||||||
.to_owned(),
|
|
||||||
person,
|
|
||||||
),
|
|
||||||
ap_sign,
|
|
||||||
); // FIXME: Don't clone()
|
|
||||||
Ok(json)
|
Ok(json)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue