mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
merge
This commit is contained in:
@@ -210,6 +210,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()
|
||||
}
|
||||
@@ -265,6 +266,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 ...
|
||||
@@ -276,13 +287,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: new Date( roomData._updatedAt || roomData._updatedAt['$date']),
|
||||
u : roomData.u || {},
|
||||
members: roomData.members
|
||||
}
|
||||
@@ -297,7 +311,7 @@ export class WsChatMethodsService {
|
||||
room.getAllUsers = this.getUsers
|
||||
room.receiveMessageDelete();
|
||||
room.sortRoomList = this.sortRoomList
|
||||
|
||||
|
||||
// create individual room
|
||||
|
||||
if(this.isIndividual(roomData)) {
|
||||
@@ -412,9 +426,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