Dont purge posts/comments when user deletes account (ref #2426)

This commit is contained in:
Felix Ableitner 2022-11-04 16:47:48 +01:00
parent b5cd732372
commit 1de7a08d97
3 changed files with 0 additions and 49 deletions

View file

@ -763,21 +763,6 @@ pub async fn delete_user_account(
}
// No need to update avatar and banner, those are handled in Person::delete_account
// Comments
let permadelete = move |conn: &mut _| Comment::permadelete_for_creator(conn, person_id);
blocking(pool, permadelete)
.await?
.map_err(|e| LemmyError::from_error_message(e, "couldnt_update_comment"))?;
// Posts
let permadelete = move |conn: &mut _| Post::permadelete_for_creator(conn, person_id);
blocking(pool, permadelete)
.await?
.map_err(|e| LemmyError::from_error_message(e, "couldnt_update_post"))?;
// Purge image posts
purge_image_posts_for_person(person_id, pool, settings, client).await?;
blocking(pool, move |conn| Person::delete_account(conn, person_id)).await??;
Ok(())

View file

@ -17,20 +17,6 @@ use diesel_ltree::Ltree;
use url::Url;
impl Comment {
pub fn permadelete_for_creator(
conn: &mut PgConnection,
for_creator_id: PersonId,
) -> Result<Vec<Self>, Error> {
use crate::schema::comment::dsl::*;
diesel::update(comment.filter(creator_id.eq(for_creator_id)))
.set((
content.eq("*Permananently Deleted*"),
deleted.eq(true),
updated.eq(naive_now()),
))
.get_results::<Self>(conn)
}
pub fn update_removed_for_creator(
conn: &mut PgConnection,
for_creator_id: PersonId,

View file

@ -69,26 +69,6 @@ impl Post {
.load::<Self>(conn)
}
pub fn permadelete_for_creator(
conn: &mut PgConnection,
for_creator_id: PersonId,
) -> Result<Vec<Self>, Error> {
use crate::schema::post::dsl::*;
let perma_deleted = "*Permananently Deleted*";
let perma_deleted_url = "https://deleted.com";
diesel::update(post.filter(creator_id.eq(for_creator_id)))
.set((
name.eq(perma_deleted),
url.eq(perma_deleted_url),
body.eq(perma_deleted),
deleted.eq(true),
updated.eq(naive_now()),
))
.get_results::<Self>(conn)
}
pub fn update_removed_for_creator(
conn: &mut PgConnection,
for_creator_id: PersonId,