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(())
}
/// Received on article origin instances
/// Received on article origin instance
async fn receive(self, data: &Data<Self::DataType>) -> Result<(), Self::Error> {
let local_article = DbArticle::read_from_ap_id(&self.object.object, data)?;
let patch = Patch::from_str(&self.object.content)?;

View file

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

View file

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