improve chat

This commit is contained in:
Peter Maquiran
2022-01-11 16:07:54 +01:00
parent dcee5aa2f4
commit ab2198a412
5 changed files with 37 additions and 65 deletions
+10 -5
View File
@@ -7,7 +7,7 @@ import { ChatUserService } from 'src/app/services/chat/chat-user.service'
})
export class RoomService {
massages: {[key: string]: MessageService} = {}
massages: MessageService[] = []
lastMessage: MessageService;
chatUser: ChatUserService[] = []
@@ -35,8 +35,7 @@ export class RoomService {
this.id,
this.constructor.name+this.id,
(Chatmessage)=>{
this.hasLoadHistory = false
this.loadHistory()
this.massages.push(Chatmessage.result)
}
)
}
@@ -50,9 +49,15 @@ export class RoomService {
if(this.hasLoadHistory){ return false }
this.RocketChatClientService.loadHistory(this.id, limit).then((message:any)=>{
this.RocketChatClientService.loadHistory(this.id, limit).then((message:any) => {
console.log('loadHistory', message)
this.mmm = message.result.messages.reverse()
message.result.messages.reverse().forEach(element => {
const message = new MessageService()
message.setData(element)
this.massages.push(message)
});
})
this.hasLoadHistory = true