1
0
Fork 0
mirror of https://github.com/Nutomic/ibis.git synced 2024-11-22 12:41:10 +00:00

Fix all tests

This commit is contained in:
Felix Ableitner 2024-11-12 12:16:59 +01:00
parent 639ca1704f
commit 5f306e6600
3 changed files with 27 additions and 19 deletions

View file

@ -80,7 +80,7 @@ impl ActivityHandler for UpdateRemoteArticle {
Ok(()) Ok(())
} }
/// Received on article origin instances /// Received on article origin instance
async fn receive(self, data: &Data<Self::DataType>) -> Result<(), Self::Error> { async fn receive(self, data: &Data<Self::DataType>) -> Result<(), Self::Error> {
let local_article = DbArticle::read_from_ap_id(&self.object.object, data)?; let local_article = DbArticle::read_from_ap_id(&self.object.object, data)?;
let patch = Patch::from_str(&self.object.content)?; let patch = Patch::from_str(&self.object.content)?;

View file

@ -79,15 +79,19 @@ impl Collection for DbArticleCollection {
_owner: &Self::Owner, _owner: &Self::Owner,
data: &Data<Self::DataType>, data: &Data<Self::DataType>,
) -> Result<Self, Self::Error> { ) -> Result<Self, Self::Error> {
join_all(apub.items.into_iter().map(|article| async { let articles =
let id = article.id.clone(); apub.items
let res = DbArticle::from_json(article, data).await; .into_iter()
if let Err(e) = &res { .filter(|i| !i.id.is_local(data))
warn!("Failed to synchronize article {id}: {e}"); .map(|article| async {
} let id = article.id.clone();
res let res = DbArticle::from_json(article, data).await;
})) if let Err(e) = &res {
.await; warn!("Failed to synchronize article {id}: {e}");
}
res
});
join_all(articles).await;
Ok(DbArticleCollection(())) Ok(DbArticleCollection(()))
} }

View file

@ -79,15 +79,19 @@ impl Collection for DbInstanceCollection {
_owner: &Self::Owner, _owner: &Self::Owner,
data: &Data<Self::DataType>, data: &Data<Self::DataType>,
) -> Result<Self, Self::Error> { ) -> Result<Self, Self::Error> {
join_all(apub.items.into_iter().map(|instance| async { let instances =
let id = instance.id.clone(); apub.items
let res = DbInstance::from_json(instance, data).await; .into_iter()
if let Err(e) = &res { .filter(|i| !i.id.is_local(data))
warn!("Failed to synchronize article {id}: {e}"); .map(|instance| async {
} let id = instance.id.clone();
res let res = DbInstance::from_json(instance, data).await;
})) if let Err(e) = &res {
.await; warn!("Failed to synchronize article {id}: {e}");
}
res
});
join_all(instances).await;
Ok(DbInstanceCollection(())) Ok(DbInstanceCollection(()))
} }