From 99db58bde24ddd82c13f37f8086bb02c1f5ca207 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Thu, 21 Jan 2021 18:36:53 +0100 Subject: [PATCH] Can delete all the conversation messages of a user --- src/helpers/account_helper.rs | 3 +++ src/helpers/conversations_helper.rs | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/src/helpers/account_helper.rs b/src/helpers/account_helper.rs index 6c3b2ba..fbe999a 100644 --- a/src/helpers/account_helper.rs +++ b/src/helpers/account_helper.rs @@ -321,6 +321,9 @@ pub fn delete(user_id: &UserID) -> ResultBoxError { // Delete all user movies movies_helper::delete_all_user(user_id)?; + // Delete all conversation messages + conversations_helper::delete_all_user_messages(user_id)?; + // TODO : continue work here Ok(()) diff --git a/src/helpers/conversations_helper.rs b/src/helpers/conversations_helper.rs index 1b325b8..b3e82a4 100644 --- a/src/helpers/conversations_helper.rs +++ b/src/helpers/conversations_helper.rs @@ -260,6 +260,15 @@ pub fn export_all_user_messages(user_id: &UserID) -> ResultBoxError ResultBoxError { + for msg in &export_all_user_messages(user_id)? { + delete_message(msg)?; + } + + Ok(()) +} + /// Get the entire list of messages of a given conversation pub fn get_all_messages(conv_id: u64) -> ResultBoxError> { database::QueryInfo::new(CONV_MESSAGES_TABLE)