added realtime to: - edit group name

- adicionar membro
- remover membro
This commit is contained in:
tiago.kayaya
2022-01-17 11:27:25 +01:00
parent 3dea6295ae
commit 936351b7ec
9 changed files with 51 additions and 34 deletions
+3 -1
View File
@@ -14,6 +14,7 @@ export class MessageService {
rid = ''
ts = {}
u = {}
t = ''
_id =''
_updatedAt = {}
file
@@ -21,7 +22,7 @@ export class MessageService {
constructor() { }
setData({customFields, channels, mentions, msg ,rid ,ts, u, _id, _updatedAt, file, attachments}:Message) {
setData({customFields, channels, mentions, msg ,rid ,ts, u, t, _id, _updatedAt, file, attachments}:Message) {
this.customFields = customFields
this.channels = channels
this.mentions = mentions
@@ -29,6 +30,7 @@ export class MessageService {
this.rid = rid
this.ts = ts
this.u = u
this.t = t
this._id = _id
this._updatedAt = _updatedAt
this.file = file
+5 -2
View File
@@ -16,6 +16,7 @@ export class RoomService {
chatUser: ChatUserService[] = []
customFields:any;
id = ''
t = ''
name = ''
_updatedAt = {}
private hasLoadHistory = false
@@ -30,10 +31,11 @@ export class RoomService {
private MessageService: MessageService,
) {}
setData({customFields, id, name, lastMessage, _updatedAt}) {
setData({customFields, id, name, t, lastMessage, _updatedAt}) {
this.customFields = customFields
this.id = id
this.name = name
this.t = t
this.lastMessage = lastMessage
this._updatedAt = _updatedAt
@@ -52,13 +54,14 @@ export class RoomService {
const message = new MessageService()
message.setData(ChatMessage)
this.lastMessage.msg = message.msg
if(message.t == 'r'){this.name = message.msg}
this.calDateDuration(ChatMessage._updatedAt)
this.massages.push(message)
setTimeout(()=>{
this.scrollDown()
}, 100)
}
)
}
@@ -27,7 +27,7 @@ export class WsChatMethodsService {
(async()=>{
await this.getAllRooms();
this.subscribeToRoom()
})()
}
@@ -50,6 +50,7 @@ export class WsChatMethodsService {
customFields: roomData.customFields,
id: this.getRoomId(roomData),
name: this.getRoomName(roomData),
t: roomData.t,
lastMessage: this.getRoomLastMessage(roomData),
_updatedAt: new Date(roomData._updatedAt['$date'])
})