Fix panic during post deletion
This commit is contained in:
parent
0dc0512328
commit
47149e5379
1 changed files with 5 additions and 2 deletions
|
@ -7,6 +7,7 @@ use crate::activitypub::deliverer::OutgoingActivity;
|
||||||
use crate::activitypub::vocabulary::{DELETE, NOTE, TOMBSTONE};
|
use crate::activitypub::vocabulary::{DELETE, NOTE, TOMBSTONE};
|
||||||
use crate::config::Instance;
|
use crate::config::Instance;
|
||||||
use crate::errors::DatabaseError;
|
use crate::errors::DatabaseError;
|
||||||
|
use crate::models::posts::helpers::add_related_posts;
|
||||||
use crate::models::posts::types::Post;
|
use crate::models::posts::types::Post;
|
||||||
use crate::models::users::types::User;
|
use crate::models::users::types::User;
|
||||||
use super::create_note::{
|
use super::create_note::{
|
||||||
|
@ -53,12 +54,14 @@ pub async fn prepare_delete_note(
|
||||||
post: &Post,
|
post: &Post,
|
||||||
) -> Result<OutgoingActivity<Activity>, DatabaseError> {
|
) -> Result<OutgoingActivity<Activity>, DatabaseError> {
|
||||||
assert_eq!(author.id, post.author.id);
|
assert_eq!(author.id, post.author.id);
|
||||||
|
let mut post = post.clone();
|
||||||
|
add_related_posts(db_client, vec![&mut post]).await?;
|
||||||
let activity = build_delete_note(
|
let activity = build_delete_note(
|
||||||
&instance.host(),
|
&instance.host(),
|
||||||
&instance.url(),
|
&instance.url(),
|
||||||
post,
|
&post,
|
||||||
);
|
);
|
||||||
let recipients = get_note_recipients(db_client, author, post).await?;
|
let recipients = get_note_recipients(db_client, author, &post).await?;
|
||||||
Ok(OutgoingActivity {
|
Ok(OutgoingActivity {
|
||||||
instance,
|
instance,
|
||||||
sender: author.clone(),
|
sender: author.clone(),
|
||||||
|
|
Loading…
Reference in a new issue