|
|
@ -45,6 +45,7 @@ use lemmy_utils::{
|
|
|
|
markdown::markdown_to_html,
|
|
|
|
markdown::markdown_to_html,
|
|
|
|
slurs::{check_slurs, check_slurs_opt},
|
|
|
|
slurs::{check_slurs, check_slurs_opt},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
LemmyErrorType,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
use std::ops::Deref;
|
|
|
|
use std::ops::Deref;
|
|
|
|
use tracing::debug;
|
|
|
|
use tracing::debug;
|
|
|
@ -137,7 +138,11 @@ impl Object for ApubSite {
|
|
|
|
|
|
|
|
|
|
|
|
#[tracing::instrument(skip_all)]
|
|
|
|
#[tracing::instrument(skip_all)]
|
|
|
|
async fn from_json(apub: Self::Kind, context: &Data<Self::DataType>) -> LemmyResult<Self> {
|
|
|
|
async fn from_json(apub: Self::Kind, context: &Data<Self::DataType>) -> LemmyResult<Self> {
|
|
|
|
let domain = apub.id.inner().domain().expect("group id has domain");
|
|
|
|
let domain = apub
|
|
|
|
|
|
|
|
.id
|
|
|
|
|
|
|
|
.inner()
|
|
|
|
|
|
|
|
.domain()
|
|
|
|
|
|
|
|
.ok_or(LemmyErrorType::UrlWithoutDomain)?;
|
|
|
|
let instance = DbInstance::read_or_create(&mut context.pool(), domain.to_string()).await?;
|
|
|
|
let instance = DbInstance::read_or_create(&mut context.pool(), domain.to_string()).await?;
|
|
|
|
|
|
|
|
|
|
|
|
let local_site = LocalSite::read(&mut context.pool()).await.ok();
|
|
|
|
let local_site = LocalSite::read(&mut context.pool()).await.ok();
|
|
|
@ -210,7 +215,9 @@ pub(in crate::objects) async fn fetch_instance_actor_for_object<T: Into<Url> + C
|
|
|
|
Err(e) => {
|
|
|
|
Err(e) => {
|
|
|
|
// Failed to fetch instance actor, its probably not a lemmy instance
|
|
|
|
// Failed to fetch instance actor, its probably not a lemmy instance
|
|
|
|
debug!("Failed to dereference site for {}: {}", &instance_id, e);
|
|
|
|
debug!("Failed to dereference site for {}: {}", &instance_id, e);
|
|
|
|
let domain = instance_id.domain().expect("has domain");
|
|
|
|
let domain = instance_id
|
|
|
|
|
|
|
|
.domain()
|
|
|
|
|
|
|
|
.ok_or(LemmyErrorType::UrlWithoutDomain)?;
|
|
|
|
Ok(
|
|
|
|
Ok(
|
|
|
|
DbInstance::read_or_create(&mut context.pool(), domain.to_string())
|
|
|
|
DbInstance::read_or_create(&mut context.pool(), domain.to_string())
|
|
|
|
.await?
|
|
|
|
.await?
|
|
|
|