mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
improve chat
This commit is contained in:
@@ -9,5 +9,24 @@ export class MessageService {
|
||||
mentions = []
|
||||
msg = ''
|
||||
rid = ''
|
||||
ts = {}
|
||||
u = {}
|
||||
_id =''
|
||||
_updatedAt = {}
|
||||
|
||||
constructor() { }
|
||||
|
||||
setData({channels, mentions, msg ,rid ,ts, u, _id, _updatedAt}) {
|
||||
this.channels = channels
|
||||
this.mentions = mentions
|
||||
this.msg = msg
|
||||
this.rid = rid
|
||||
this.ts = ts
|
||||
this.u = u
|
||||
this._id = _id
|
||||
this._updatedAt = _updatedAt
|
||||
}
|
||||
|
||||
delete() {}
|
||||
|
||||
}
|
||||
|
||||
@@ -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