Use OneOrMany<AnyBase>::to_as_uri()

This commit is contained in:
Kitaiti Makoto 2022-02-13 01:23:47 +09:00
parent bb5157637d
commit 4ccfec8019

View File

@ -27,7 +27,7 @@ use plume_common::{
request::get, request::get,
sign::{gen_keypair, Error as SignError, Result as SignResult, Signer}, sign::{gen_keypair, Error as SignError, Result as SignResult, Signer},
ActivityStream, ApSignature, CustomPerson as CustomPerson07, Id, IntoId, PublicKey, ActivityStream, ApSignature, CustomPerson as CustomPerson07, Id, IntoId, PublicKey,
ToAsString, PUBLIC_VISIBILITY, ToAsString, ToAsUri, PUBLIC_VISIBILITY,
}, },
utils, utils,
}; };
@ -1075,16 +1075,7 @@ impl FromId07<DbConn> for User {
}; };
let avatar_id = if let Some(icon) = acct.object_ref().icon() { let avatar_id = if let Some(icon) = acct.object_ref().icon() {
if let Some(prop) = icon.as_one() { icon.to_as_uri()
prop.as_xsd_any_uri().map(|uri| uri.to_string())
} else if let Some(prop) = icon.as_many() {
prop.iter()
.next()
.and_then(|p| p.as_xsd_any_uri())
.map(|uri| uri.to_string())
} else {
None
}
} else { } else {
None None
}; };