1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-12-26 13:38:52 +00:00

Delete all conversation messages of the user

This commit is contained in:
Pierre HUBERT 2020-03-27 14:14:45 +01:00
parent 50e2277a30
commit 01245a1778
2 changed files with 14 additions and 1 deletions

View File

@ -459,8 +459,11 @@ export class AccountHelper {
// Delete all user movies
await MoviesHelper.DeleteAllUser(userID);
*/
// Delete conversation messages
await ConversationsHelper.DeleteAllUserMessages(userID);
*/
// TODO : continue work
}

View File

@ -380,6 +380,16 @@ export class ConversationsHelper {
})).map(m => this.DBToConversationMessage(m.conv_id, m));
}
/**
* Delete all the messages of a given user
*
* @param userID Target user ID
*/
public static async DeleteAllUserMessages(userID: number) {
for(const msg of await this.ExportAllMessages(userID))
await this.DeleteMessage(msg);
}
/**
* Mark the user has seen the last messages of the conversation
*