mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
improve chat
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user