Build CustomPerson from source string at once
This commit is contained in:
parent
d36f13e984
commit
399af4004a
@ -246,20 +246,7 @@ impl User {
|
||||
fn fetch(url: &str) -> Result<CustomPerson> {
|
||||
let res = get(url, Self::get_sender(), CONFIG.proxy().cloned())?;
|
||||
let text = &res.text()?;
|
||||
// without this workaround, publicKey is not correctly deserialized
|
||||
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()
|
||||
let json = serde_json::from_str::<CustomPerson>(text)?;
|
||||
Ok(json)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user