mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
save
This commit is contained in:
@@ -199,6 +199,7 @@ export class WsChatMethodsService {
|
||||
* @description sort room list by last message date
|
||||
*/
|
||||
sortRoomList =() => {
|
||||
|
||||
this._dm = this.sortService.sortDate(this._dm,'_updatedAt').reverse()
|
||||
this._group = this.sortService.sortDate(this._group,'_updatedAt').reverse()
|
||||
}
|
||||
@@ -252,6 +253,16 @@ export class WsChatMethodsService {
|
||||
})
|
||||
}
|
||||
|
||||
private fix_updatedAt(message) {
|
||||
if (message.result) {
|
||||
message.result._updatedAt = message.result._updatedAt['$date']
|
||||
} else if(message._updatedAt) {
|
||||
if(message._updatedAt.hasOwnProperty('$date')) {
|
||||
message._updatedAt = message._updatedAt['$date']
|
||||
}
|
||||
}
|
||||
return message
|
||||
}
|
||||
|
||||
/**
|
||||
* @description create a representation of an room in these instance this.dm, this.group ...
|
||||
@@ -263,13 +274,16 @@ export class WsChatMethodsService {
|
||||
/**
|
||||
* @description data used to define or create room
|
||||
*/
|
||||
|
||||
|
||||
roomData = this.fix_updatedAt(roomData)
|
||||
const setData = {
|
||||
customFields: roomData.customFields,
|
||||
id: this.getRoomId(roomData),
|
||||
name: this.getRoomName(roomData),
|
||||
t: roomData.t,
|
||||
lastMessage: this.getRoomLastMessage(roomData),
|
||||
_updatedAt: new Date(roomData._updatedAt['$date'])
|
||||
_updatedAt: roomData._updatedAt
|
||||
}
|
||||
|
||||
let roomId = this.getRoomId(roomData)
|
||||
@@ -282,7 +296,7 @@ export class WsChatMethodsService {
|
||||
room.getAllUsers = this.getUsers
|
||||
room.receiveMessageDelete();
|
||||
room.sortRoomList = this.sortRoomList
|
||||
|
||||
|
||||
// create individual room
|
||||
|
||||
if(this.isIndividual(roomData)) {
|
||||
@@ -398,9 +412,9 @@ export class WsChatMethodsService {
|
||||
}
|
||||
|
||||
hidingRoom(id?) {
|
||||
|
||||
|
||||
return this.WsChatService.hidingRoom(id).then(()=>{
|
||||
// this.hideRoom(id)
|
||||
// this.hideRoom(id)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user