Fix deletion of private notes (#814)

This commit is contained in:
Geometrically
2023-12-28 20:25:55 -05:00
committed by GitHub
parent f199ecf8e9
commit cf9c8cbb4f
4 changed files with 26 additions and 6 deletions

View File

@@ -611,7 +611,15 @@ pub async fn message_delete(
database::Image::remove(image.id, &mut transaction, &redis).await?;
}
database::models::ThreadMessage::remove_full(thread.id, &mut transaction).await?;
let private = if let MessageBody::Text { private, .. } = thread.body {
private
} else if let MessageBody::Deleted { private, .. } = thread.body {
private
} else {
false
};
database::models::ThreadMessage::remove_full(thread.id, private, &mut transaction).await?;
transaction.commit().await?;
Ok(HttpResponse::NoContent().body(""))