diff --git a/src/helpers/AccountHelper.ts b/src/helpers/AccountHelper.ts index 31ae03c..e3c588a 100644 --- a/src/helpers/AccountHelper.ts +++ b/src/helpers/AccountHelper.ts @@ -462,8 +462,11 @@ export class AccountHelper { // Delete conversation messages await ConversationsHelper.DeleteAllUserMessages(userID); + + // Remove the user from all its conversations + await ConversationsHelper.DeleteAllUserConversations(userID); */ - + // TODO : continue work } diff --git a/src/helpers/ConversationsHelper.ts b/src/helpers/ConversationsHelper.ts index 0f1c157..5eaea03 100644 --- a/src/helpers/ConversationsHelper.ts +++ b/src/helpers/ConversationsHelper.ts @@ -390,6 +390,16 @@ export class ConversationsHelper { await this.DeleteMessage(msg); } + /** + * Remove the user from all the conversations he belongs to + * + * @param userID Target user ID + */ + public static async DeleteAllUserConversations(userID: number) { + for(const conv of await this.GetListUser(userID)) + await this.RemoveUserFromConversation(userID, conv.id); + } + /** * Mark the user has seen the last messages of the conversation *