Fix: Order of rooms.

This commit is contained in:
elweyn 2023-07-20 14:18:25 +02:00
parent 0bd7968272
commit 21124bcd71
2 changed files with 4 additions and 2 deletions

View File

@ -257,7 +257,7 @@ export default {
const rmsIds = [] const rmsIds = []
;[...Room, ...this.rooms].forEach((r) => { ;[...Room, ...this.rooms].forEach((r) => {
if (!rmsIds.find((v) => v === r.id)) { if (!rmsIds.find((v) => v === r.id)) {
rms.push(this.fixRoomObject(r)) rms.unshift(this.fixRoomObject(r))
rmsIds.push(r.id) rmsIds.push(r.id)
} }
}) })
@ -405,7 +405,7 @@ export default {
// This fixes the room object which arrives from the backend // This fixes the room object which arrives from the backend
const fixedRoom = { const fixedRoom = {
...room, ...room,
index: room.lastMessage?.date, index: room.lastMessage? room.lastMessage.date : room.createdAt,
lastMessage: room.lastMessage lastMessage: room.lastMessage
? { ? {
...room.lastMessage, ...room.lastMessage,

View File

@ -7,6 +7,7 @@ export const createRoom = () => gql`
roomId roomId
roomName roomName
lastMessageAt lastMessageAt
createdAt
unreadCount unreadCount
#avatar #avatar
users { users {
@ -29,6 +30,7 @@ export const roomQuery = () => gql`
roomName roomName
avatar avatar
lastMessageAt lastMessageAt
createdAt
unreadCount unreadCount
lastMessage { lastMessage {
_id _id