mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-16 09:24:00 +00:00
parent
38d4429ae7
commit
148f33def5
2 changed files with 15 additions and 1 deletions
|
@ -6,7 +6,7 @@ use lemmy_db_schema::{
|
||||||
newtypes::{CommunityId, DbUrl, LocalUserId, PersonId, PostId},
|
newtypes::{CommunityId, DbUrl, LocalUserId, PersonId, PostId},
|
||||||
source::{
|
source::{
|
||||||
comment::{Comment, CommentUpdateForm},
|
comment::{Comment, CommentUpdateForm},
|
||||||
community::{Community, CommunityUpdateForm},
|
community::{Community, CommunityModerator, CommunityUpdateForm},
|
||||||
email_verification::{EmailVerification, EmailVerificationForm},
|
email_verification::{EmailVerification, EmailVerificationForm},
|
||||||
instance::Instance,
|
instance::Instance,
|
||||||
local_site::{LocalSite, RegistrationMode},
|
local_site::{LocalSite, RegistrationMode},
|
||||||
|
@ -774,6 +774,9 @@ pub async fn delete_user_account(
|
||||||
// Purge image posts
|
// Purge image posts
|
||||||
purge_image_posts_for_person(person_id, pool, settings, client).await?;
|
purge_image_posts_for_person(person_id, pool, settings, client).await?;
|
||||||
|
|
||||||
|
// Leave communities they mod
|
||||||
|
CommunityModerator::leave_all_communities(pool, person_id).await?;
|
||||||
|
|
||||||
Person::delete_account(pool, person_id).await?;
|
Person::delete_account(pool, person_id).await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -152,6 +152,17 @@ impl CommunityModerator {
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn leave_all_communities(
|
||||||
|
pool: &DbPool,
|
||||||
|
for_person_id: PersonId,
|
||||||
|
) -> Result<usize, Error> {
|
||||||
|
use crate::schema::community_moderator::dsl::{community_moderator, person_id};
|
||||||
|
let conn = &mut get_conn(pool).await?;
|
||||||
|
diesel::delete(community_moderator.filter(person_id.eq(for_person_id)))
|
||||||
|
.execute(conn)
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn get_person_moderated_communities(
|
pub async fn get_person_moderated_communities(
|
||||||
pool: &DbPool,
|
pool: &DbPool,
|
||||||
for_person_id: PersonId,
|
for_person_id: PersonId,
|
||||||
|
|
Loading…
Reference in a new issue