1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-12-27 22:18:51 +00:00

Delete all comments of user

This commit is contained in:
Pierre HUBERT 2021-01-21 18:13:01 +01:00
parent f325ec7ae7
commit 5a7e356265
2 changed files with 12 additions and 0 deletions

View File

@ -306,6 +306,9 @@ pub fn delete(user_id: &UserID) -> ResultBoxError {
// Delete all group membership
groups_helper::delete_all_user_groups(user_id)?;
// Delete all user comments
comments_helper::delete_all_user(user_id)?;
// TODO : continue work here
Ok(())

View File

@ -97,5 +97,14 @@ pub fn delete_all(post_id: u64) -> ResultBoxError {
delete(c)?;
}
Ok(())
}
/// Delete all the comments created by a user
pub fn delete_all_user(user_id: &UserID) -> ResultBoxError {
for comment in &export_all_user(user_id)? {
delete(comment)?;
}
Ok(())
}