mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-12-22 10:06:30 +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 diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl, SaveChangesDsl};
|
||||
use futures::stream::{self, StreamExt};
|
||||
use plume_common::{
|
||||
activity_pub::{
|
||||
inbox::{AsActor, AsObject, FromId},
|
||||
|
@ -131,12 +130,16 @@ impl Comment {
|
|||
.set_published_string(chrono::Utc::now().to_rfc3339())?;
|
||||
note.object_props.set_attributed_to_link(author.into_id())?;
|
||||
note.object_props.set_to_link_vec(to)?;
|
||||
note.object_props.set_tag_link_vec(
|
||||
stream::iter(mentions)
|
||||
.filter_map(|m| async move { Mention::build_activity(c, &m).await.ok() })
|
||||
.collect::<Vec<link::Mention>>()
|
||||
.await,
|
||||
)?;
|
||||
|
||||
let mut tag_link_vec = vec![];
|
||||
let mut iter = mentions.into_iter();
|
||||
while let Some(m) = iter.next() {
|
||||
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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue