diff --git a/src/app/services/chat/room.service.ts b/src/app/services/chat/room.service.ts index 2b2070aef..5abdb2aa1 100644 --- a/src/app/services/chat/room.service.ts +++ b/src/app/services/chat/room.service.ts @@ -718,24 +718,23 @@ export class RoomService { await this.restoreMessageFromDB() } + + + await this.WsChatService.loadHistory(this.id, limit).then( async (chatHistory:chatHistory) => { // console.log('load history', chatHistory) // const messagesId = this.messages.map((message)=> message._id) - await chatHistory.result.messages.reverse().forEach(async(message: any) => { - + for(let message of chatHistory.result.messages.reverse()) { if (!messagesId.includes(message._id)) { const messagesToSave = await this.prepareMessageCreateIfNotExist_iD({message: message}); if(messagesToSave) { messagesToSave.addMessageDB() } } - - }) - - + } }) setTimeout(() => {