fix direct room

This commit is contained in:
Peter Maquiran
2024-09-18 11:47:23 +01:00
parent eeaade9aab
commit 01c2f5efb5
19 changed files with 184 additions and 76 deletions
@@ -11,11 +11,13 @@ export function roomListDetermineChanges(serverRooms: RoomListItemOutPutDTO[], l
const roomsToUpdate = serverRooms.filter(room => {
const localRoom = localRoomMap.get(room.chatRoom.id);
console.log(room.chatRoom, localRoom)
return localRoom && (
room.chatRoom.roomName !== localRoom.roomName && room.chatRoom.roomType == RoomType.Group ||
room.chatRoom.createdBy.wxUserId !== localRoom.createdBy.wxUserId ||
room.chatRoom.createdAt !== localRoom.createdAt ||
room.chatRoom.expirationDate !== localRoom.expirationDate // ||
room.chatRoom.createdAt !== localRoom.createdAt
//room.chatRoom.expirationDate !== localRoom.expirationDate // ||
// room.chatRoom.messages?.[0]?.id !== localRoom.messages?.[0]?.id
// room.chatRoom.roomType !== localRoom.roomType
);
@@ -47,6 +47,10 @@ export class RoomLocalRepository extends DexieRepository<RoomTable, RoomTable> i
(modifications as Partial<RoomTable>).local = IDBoolean.true
}
if((modifications as Partial<RoomTable>).id && !oldValue.id && oldValue.roomType == RoomType.Direct) {
return this.listenCreateSyncSubject.next({...oldValue, ...modifications})
}
return modifications
});
@@ -60,5 +64,10 @@ export class RoomLocalRepository extends DexieRepository<RoomTable, RoomTable> i
return from(liveQuery(() => chatDatabase.room.get(id)));
}
OnSetIdToDirectRoom() {
return this.listenCreateSyncSubject.asObservable()
}
}