diff --git a/src/app/services/chat/room.service.ts b/src/app/services/chat/room.service.ts index 3147642de..11dd10f93 100644 --- a/src/app/services/chat/room.service.ts +++ b/src/app/services/chat/room.service.ts @@ -627,25 +627,25 @@ export class RoomService { await this.restoreMessageFromDB() } - // await this.WsChatService.loadHistory(this.id, limit).then( async (chatHistory:chatHistory) => { + await this.WsChatService.loadHistory(this.id, limit).then( async (chatHistory:chatHistory) => { - // console.log('load chatHistory', JSON.stringify(chatHistory)) + console.log('load chatHistory', JSON.stringify(chatHistory)) - // const messagesId = this.messages.map((message)=> message._id) + const messagesId = this.messages.map((message)=> message._id) - // chatHistory.result.messages.reverse().forEach(async(message: any) => { + chatHistory.result.messages.reverse().forEach(async(message: any) => { - // if (!messagesId.includes(message._id)) { - // const messagesToSave = await this.prepareMessageCreateIfNotExist_iD({message: message}); - // if(messagesToSave) { - // await messagesToSave.addMessageDB() - // } - // } + if (!messagesId.includes(message._id)) { + const messagesToSave = await this.prepareMessageCreateIfNotExist_iD({message: message}); + if(messagesToSave) { + await messagesToSave.addMessageDB() + } + } - // }) + }) - // }) + }) setTimeout(() => { this.scrollDown()