1
0
Fork 0
mirror of https://github.com/Nutomic/ibis.git synced 2024-12-23 20:11:24 +00:00
This commit is contained in:
Felix Ableitner 2024-03-12 15:42:15 +01:00
parent 09b68d0411
commit 011c641664
2 changed files with 5 additions and 8 deletions

View file

@ -49,7 +49,7 @@ pub(in crate::backend::api) async fn create_article(
}
let local_instance = DbInstance::read_local_instance(&data)?;
let escaped_title = create_article.title.replace(" ", "_");
let escaped_title = create_article.title.replace(' ', "_");
let ap_id = ObjectId::parse(&format!(
"{}://{}/article/{}",
http_protocol_str(),
@ -76,7 +76,6 @@ pub(in crate::backend::api) async fn create_article(
let _ = edit_article(Extension(user), data.reset_request_count(), Form(edit_data)).await?;
let article_view = DbArticle::read_view(article.id, &data)?;
dbg!(&article_view);
CreateArticle::send_to_followers(article_view.article.clone(), &data).await?;
Ok(Json(article_view))

View file

@ -66,14 +66,12 @@ impl Object for DbArticle {
expected_domain: &Url,
_data: &Data<Self::DataType>,
) -> Result<(), Self::Error> {
dbg!(&json);
dbg!(verify_domains_match(json.id.inner(), expected_domain))?;
verify_domains_match(json.id.inner(), expected_domain)?;
Ok(())
}
async fn from_json(json: Self::Kind, data: &Data<Self::DataType>) -> Result<Self, Self::Error> {
dbg!(&json);
let instance = dbg!(json.attributed_to.dereference(data).await)?;
let instance = json.attributed_to.dereference(data).await?;
let form = DbArticleForm {
title: json.name,
text: json.content,
@ -82,9 +80,9 @@ impl Object for DbArticle {
instance_id: instance.id,
protected: json.protected,
};
let article = dbg!(DbArticle::create_or_update(form, data))?;
let article = DbArticle::create_or_update(form, data)?;
dbg!(json.edits.dereference(&article, data).await)?;
json.edits.dereference(&article, data).await?;
Ok(article)
}