You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-08-18 05:42:00 +03:00
Pass in receipts from initialSync
This commit is contained in:
@@ -1903,6 +1903,19 @@ function doInitialSync(client, historyLen) {
|
||||
user.setPresenceEvent(e);
|
||||
client.store.storeUser(user);
|
||||
});
|
||||
|
||||
// group receipts by room ID.
|
||||
var receiptsByRoom = {};
|
||||
data.receipts = data.receipts || [];
|
||||
utils.forEach(data.receipts.map(_PojoToMatrixEventMapper(client)),
|
||||
function(receiptEvent) {
|
||||
if (!receiptsByRoom[receiptEvent.getRoomId()]) {
|
||||
receiptsByRoom[receiptEvent.getRoomId()] = [];
|
||||
}
|
||||
receiptsByRoom[receiptEvent.getRoomId()].push(receiptEvent);
|
||||
}
|
||||
);
|
||||
|
||||
for (i = 0; i < data.rooms.length; i++) {
|
||||
var room = createNewRoom(client, data.rooms[i].room_id);
|
||||
if (!data.rooms[i].state) {
|
||||
@@ -1926,6 +1939,11 @@ function doInitialSync(client, historyLen) {
|
||||
client, room, data.rooms[i].state, data.rooms[i].messages
|
||||
);
|
||||
|
||||
var receipts = receiptsByRoom[room.roomId] || [];
|
||||
for (j = 0; j < receipts.length; j++) {
|
||||
room.addReceipt(receipts[j]);
|
||||
}
|
||||
|
||||
// cache the name/summary/etc prior to storage since we don't
|
||||
// know how the store will serialise the Room.
|
||||
room.recalculate(client.credentials.userId);
|
||||
|
Reference in New Issue
Block a user