mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-11-22 03:21:01 +00:00
Work around a difficult lifetime interaction between closures and async blocks.
This commit is contained in:
parent
e322d9509a
commit
4f904b7ac7
1 changed files with 10 additions and 7 deletions
|
@ -17,7 +17,6 @@ use activitypub::{
|
||||||
};
|
};
|
||||||
use chrono::{self, NaiveDateTime};
|
use chrono::{self, NaiveDateTime};
|
||||||
use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl, SaveChangesDsl};
|
use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl, SaveChangesDsl};
|
||||||
use futures::stream::{self, StreamExt};
|
|
||||||
use plume_common::{
|
use plume_common::{
|
||||||
activity_pub::{
|
activity_pub::{
|
||||||
inbox::{AsActor, AsObject, FromId},
|
inbox::{AsActor, AsObject, FromId},
|
||||||
|
@ -131,12 +130,16 @@ impl Comment {
|
||||||
.set_published_string(chrono::Utc::now().to_rfc3339())?;
|
.set_published_string(chrono::Utc::now().to_rfc3339())?;
|
||||||
note.object_props.set_attributed_to_link(author.into_id())?;
|
note.object_props.set_attributed_to_link(author.into_id())?;
|
||||||
note.object_props.set_to_link_vec(to)?;
|
note.object_props.set_to_link_vec(to)?;
|
||||||
note.object_props.set_tag_link_vec(
|
|
||||||
stream::iter(mentions)
|
let mut tag_link_vec = vec![];
|
||||||
.filter_map(|m| async move { Mention::build_activity(c, &m).await.ok() })
|
let mut iter = mentions.into_iter();
|
||||||
.collect::<Vec<link::Mention>>()
|
while let Some(m) = iter.next() {
|
||||||
.await,
|
if let Ok(a) = Mention::build_activity(c, &m).await {
|
||||||
)?;
|
tag_link_vec.push(a);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
note.object_props.set_tag_link_vec(tag_link_vec)?;
|
||||||
|
|
||||||
Ok(note)
|
Ok(note)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue