Adding a boolean check to send_activity_internal
This commit is contained in:
parent
9e84fe20e6
commit
ca4868cefd
1 changed files with 11 additions and 1 deletions
|
@ -47,6 +47,7 @@ where
|
||||||
creator,
|
creator,
|
||||||
vec![to],
|
vec![to],
|
||||||
context.pool(),
|
context.pool(),
|
||||||
|
true,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
|
@ -85,6 +86,7 @@ where
|
||||||
community,
|
community,
|
||||||
to,
|
to,
|
||||||
context.pool(),
|
context.pool(),
|
||||||
|
true,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
@ -114,6 +116,7 @@ where
|
||||||
creator,
|
creator,
|
||||||
vec![inbox],
|
vec![inbox],
|
||||||
context.pool(),
|
context.pool(),
|
||||||
|
true,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
|
@ -143,6 +146,7 @@ where
|
||||||
creator,
|
creator,
|
||||||
mentions,
|
mentions,
|
||||||
context.pool(),
|
context.pool(),
|
||||||
|
false, // Don't create a new DB row
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -158,6 +162,7 @@ async fn send_activity_internal<T, Kind>(
|
||||||
actor: &dyn ActorType,
|
actor: &dyn ActorType,
|
||||||
to: Vec<Url>,
|
to: Vec<Url>,
|
||||||
pool: &DbPool,
|
pool: &DbPool,
|
||||||
|
insert_into_db: bool,
|
||||||
) -> Result<(), LemmyError>
|
) -> Result<(), LemmyError>
|
||||||
where
|
where
|
||||||
T: AsObject<Kind> + Extends<Kind>,
|
T: AsObject<Kind> + Extends<Kind>,
|
||||||
|
@ -174,7 +179,12 @@ where
|
||||||
|
|
||||||
let activity = activity.into_any_base()?;
|
let activity = activity.into_any_base()?;
|
||||||
let serialised_activity = serde_json::to_string(&activity)?;
|
let serialised_activity = serde_json::to_string(&activity)?;
|
||||||
|
|
||||||
|
// This is necessary because send_comment and send_comment_mentions
|
||||||
|
// might send the same ap_id
|
||||||
|
if insert_into_db {
|
||||||
insert_activity(actor.user_id(), activity.clone(), true, pool).await?;
|
insert_activity(actor.user_id(), activity.clone(), true, pool).await?;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: it would make sense to create a separate task for each destination server
|
// TODO: it would make sense to create a separate task for each destination server
|
||||||
let message = SendActivityTask {
|
let message = SendActivityTask {
|
||||||
|
|
Loading…
Reference in a new issue