Allow empty avatar for remote users
This commit is contained in:
parent
399af4004a
commit
f138ae6ed9
@ -256,23 +256,13 @@ impl User {
|
|||||||
|
|
||||||
pub fn refetch(&self, conn: &Connection) -> Result<()> {
|
pub fn refetch(&self, conn: &Connection) -> Result<()> {
|
||||||
User::fetch(&self.ap_url.clone()).and_then(|json| {
|
User::fetch(&self.ap_url.clone()).and_then(|json| {
|
||||||
let avatar = Media::save_remote(
|
let avatar = json
|
||||||
conn,
|
|
||||||
json.ap_actor_ref()
|
|
||||||
.icon()
|
.icon()
|
||||||
.ok_or(Error::MissingApProperty)? // FIXME: Fails when icon is not set
|
.and_then(|icon| icon.iter().next())
|
||||||
.iter()
|
.and_then(|i| i.clone().extend::<Image, ImageType>().ok())
|
||||||
.next()
|
.and_then(|image| image)
|
||||||
.and_then(|i| {
|
.and_then(|image| image.id_unchecked().map(|url| url.to_string()))
|
||||||
i.clone()
|
.and_then(|url| Media::save_remote(conn, url, self).ok());
|
||||||
.extend::<Image, ImageType>() // FIXME: Don't clone()
|
|
||||||
.ok()?
|
|
||||||
.and_then(|url| Some(url.id_unchecked()?.to_string()))
|
|
||||||
})
|
|
||||||
.ok_or(Error::MissingApProperty)?,
|
|
||||||
self,
|
|
||||||
)
|
|
||||||
.ok();
|
|
||||||
|
|
||||||
let pub_key = &json.ext_one.public_key.public_key_pem;
|
let pub_key = &json.ext_one.public_key.public_key_pem;
|
||||||
diesel::update(self)
|
diesel::update(self)
|
||||||
|
Loading…
Reference in New Issue
Block a user