You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-08-09 10:22:46 +03:00
Persist notification counts and treat them as clobbers
This commit is contained in:
@@ -57,7 +57,8 @@ class SyncAccumulator {
|
||||
// { event: $event, token: null|token },
|
||||
// ...
|
||||
// ],
|
||||
// _accountData: { $event_type: json }
|
||||
// _accountData: { $event_type: json },
|
||||
// _unreadNotifications: { ... unread_notifications JSON ... }
|
||||
//}
|
||||
};
|
||||
// the /sync token which corresponds to the last time rooms were
|
||||
@@ -218,6 +219,7 @@ class SyncAccumulator {
|
||||
_currentState: Object.create(null),
|
||||
_timeline: [],
|
||||
_accountData: Object.create(null),
|
||||
_unreadNotifications: {},
|
||||
};
|
||||
}
|
||||
const currentData = this.joinRooms[roomId];
|
||||
@@ -229,6 +231,11 @@ class SyncAccumulator {
|
||||
});
|
||||
}
|
||||
|
||||
// these probably clobber, spec is unclear.
|
||||
if (data.unread_notifications) {
|
||||
currentData._unreadNotifications = data.unread_notifications;
|
||||
}
|
||||
|
||||
// Work out the current state. The deltas need to be applied in the order:
|
||||
// - existing state which didn't come down /sync.
|
||||
// - State events under the 'state' key.
|
||||
@@ -306,6 +313,7 @@ class SyncAccumulator {
|
||||
events: [],
|
||||
prev_batch: null,
|
||||
},
|
||||
unread_notifications: roomData._unreadNotifications,
|
||||
};
|
||||
// Add account data
|
||||
Object.keys(roomData._accountData).forEach((evType) => {
|
||||
|
Reference in New Issue
Block a user