mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-12-27 22:18:51 +00:00
Can delete all the custom emojies of a given user
This commit is contained in:
parent
61cb9e671c
commit
472f44b5a5
@ -9,7 +9,7 @@ use crate::data::new_account::NewAccount;
|
||||
use crate::data::security_settings::SecuritySettings;
|
||||
use crate::data::user::{AccountImageVisibility, UserID, UserPageStatus};
|
||||
use crate::data::user_token::UserAccessToken;
|
||||
use crate::helpers::{comments_helper, conversations_helper, database, friends_helper, groups_helper, likes_helper, movies_helper, notifications_helper, posts_helper, survey_helper, user_helper};
|
||||
use crate::helpers::{comments_helper, conversations_helper, custom_emojies_helper, database, friends_helper, groups_helper, likes_helper, movies_helper, notifications_helper, posts_helper, survey_helper, user_helper};
|
||||
use crate::helpers::database::{DeleteQuery, InsertQuery, QueryInfo};
|
||||
use crate::helpers::likes_helper::LikeType;
|
||||
use crate::utils::crypt_utils::{crypt_pass, rand_str};
|
||||
@ -340,6 +340,9 @@ pub fn delete(user_id: &UserID) -> ResultBoxError {
|
||||
// Delete all the likes on the user page
|
||||
likes_helper::delete_all(user_id.id(), LikeType::USER)?;
|
||||
|
||||
// Delete all custom user emojies
|
||||
custom_emojies_helper::delete_all_user(user_id)?;
|
||||
|
||||
// TODO : continue work here
|
||||
|
||||
Ok(())
|
||||
|
@ -54,6 +54,15 @@ pub fn delete(c: &CustomEmoji) -> ResultBoxError {
|
||||
.exec()
|
||||
}
|
||||
|
||||
/// Delete all the custom emojies of a user
|
||||
pub fn delete_all_user(user_id: &UserID) -> ResultBoxError {
|
||||
for emoji in &get_list_user(user_id)? {
|
||||
delete(emoji)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Turn a database entry into a [CustomEmoji]
|
||||
fn db_to_custom_emoji(row: &database::RowResult) -> ResultBoxError<CustomEmoji> {
|
||||
Ok(CustomEmoji {
|
||||
|
Loading…
Reference in New Issue
Block a user