improve code

This commit is contained in:
Peter Maquiran
2022-01-29 19:44:20 +01:00
parent 64cebb6691
commit c00b6e444c
@@ -91,39 +91,35 @@ export class WsChatMethodsService {
if(message.fields.args[0].rid) {
setTimeout(()=>{
console.log('sort this._dm', this._dm)
this._dm = this.sortService.sortDate(this._dm,'_updatedAt').reverse()
this._group = this.sortService.sortDate(this._group,'_updatedAt').reverse()
this.sortRoomList()
}, 100)
}
}
if(message.msg =='changed' && message.collection == "stream-notify-room") {
if(message.fields.eventName.includes('deleteMessage')){
setTimeout(()=>{
console.log('sort this._dm', this._dm)
this._dm = this.sortService.sortDate(this._dm,'_updatedAt').reverse()
this._group = this.sortService.sortDate(this._group,'_updatedAt').reverse()
this.sortRoomList()
}, 100)
}
}
}
})
await rooms.result.update.forEach( async (roomData: room) => {
await this.prepareRoom(roomData);
});
this._dm = this.sortService.sortDate(this._dm,'_updatedAt').reverse()
this._group = this.sortService.sortDate(this._group,'_updatedAt').reverse()
this.sortRoomList()
this.loadingWholeList = false
}
sortRoomList() {
this._dm = this.sortService.sortDate(this._dm,'_updatedAt').reverse()
this._group = this.sortService.sortDate(this._group,'_updatedAt').reverse()
}
subscribeToRoom() {