1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-11-21 21:09:22 +00:00

Can remove user from all its conversations

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

View File

@ -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
}

View File

@ -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
*