fix: set prev_batch when seen in sync
This commit is contained in:
parent
850741df17
commit
f4c6c8d203
|
|
@ -594,7 +594,7 @@ class FakeMatrixApi extends BaseClient {
|
|||
}
|
||||
],
|
||||
'limited': true,
|
||||
'prev_batch': 't34-23535_0_0',
|
||||
'prev_batch': 't44-23535_0_0',
|
||||
},
|
||||
'ephemeral': {
|
||||
'events': [
|
||||
|
|
@ -711,7 +711,7 @@ class FakeMatrixApi extends BaseClient {
|
|||
},
|
||||
],
|
||||
'limited': true,
|
||||
'prev_batch': 't34-23535_0_0',
|
||||
'prev_batch': 't34-23535_0_1',
|
||||
},
|
||||
'account_data': {
|
||||
'events': [
|
||||
|
|
|
|||
|
|
@ -2989,7 +2989,9 @@ class Client extends MatrixApi {
|
|||
chatUpdate.unreadNotifications?.notificationCount ?? 0;
|
||||
rooms[roomIndex].highlightCount =
|
||||
chatUpdate.unreadNotifications?.highlightCount ?? 0;
|
||||
|
||||
if (chatUpdate.timeline?.prevBatch != null) {
|
||||
rooms[roomIndex].prev_batch = chatUpdate.timeline?.prevBatch;
|
||||
}
|
||||
final summary = chatUpdate.summary;
|
||||
if (summary != null) {
|
||||
final roomSummaryJson = rooms[roomIndex].summary.toJson()
|
||||
|
|
|
|||
|
|
@ -761,6 +761,31 @@ void main() {
|
|||
expect(room.lastEvent!.content['body'], '* foxies');
|
||||
});
|
||||
|
||||
test('set prev_batch if in sync', () async {
|
||||
final roomId = '!726s6s6q:example.com';
|
||||
final room = matrix.getRoomById(roomId)!;
|
||||
|
||||
expect(room.prev_batch, 't44-23535_0_0');
|
||||
// put an important state event in-memory
|
||||
await matrix.handleSync(
|
||||
SyncUpdate.fromJson({
|
||||
'next_batch': 'fakesync',
|
||||
'rooms': {
|
||||
'join': {
|
||||
roomId: {
|
||||
'timeline': {
|
||||
'events': [],
|
||||
'prev_batch': 'prev_batch_1',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
expect(room.prev_batch, 'prev_batch_1');
|
||||
});
|
||||
|
||||
test('getProfileFromUserId', () async {
|
||||
final cachedProfile = await matrix.getUserProfile('@getme:example.com');
|
||||
expect(cachedProfile.outdated, false);
|
||||
|
|
|
|||
Loading…
Reference in New Issue