forked from alemi/upub
fix: treat lemmy images like attachments
This commit is contained in:
parent
b9f512a988
commit
ab0300894f
2 changed files with 14 additions and 0 deletions
|
@ -297,6 +297,13 @@ async fn fetch_object_inner(ctx: &Context, id: &str, depth: usize) -> crate::Res
|
|||
.exec(ctx.db())
|
||||
.await?;
|
||||
}
|
||||
// lemmy sends us an image field in posts, treat it like an attachment i'd say
|
||||
if let Some(img) = object.image().get() {
|
||||
let attachment_model = model::attachment::ActiveModel::new(img, object_model.id.clone())?;
|
||||
model::attachment::Entity::insert(attachment_model)
|
||||
.exec(ctx.db())
|
||||
.await?;
|
||||
}
|
||||
|
||||
let expanded_addresses = ctx.expand_addressing(addressed).await?;
|
||||
ctx.address_to(None, Some(&object_model.id), &expanded_addresses).await?;
|
||||
|
|
|
@ -59,6 +59,13 @@ impl apb::server::Inbox for Context {
|
|||
.exec(self.db())
|
||||
.await?;
|
||||
}
|
||||
// lemmy sends us an image field in posts, treat it like an attachment i'd say
|
||||
if let Some(img) = object.image().get() {
|
||||
let attachment_model = model::attachment::ActiveModel::new(img, object_model.id.clone())?;
|
||||
model::attachment::Entity::insert(attachment_model)
|
||||
.exec(ctx.db())
|
||||
.await?;
|
||||
}
|
||||
// TODO can we even receive anonymous objects?
|
||||
if let Some(object_author) = uid {
|
||||
model::user::Entity::update_many()
|
||||
|
|
Loading…
Reference in a new issue