mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-11-14 07:51:01 +00:00
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> {
|
||||
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 a new issue