refactor: Make optional eventId a named parameter

This should not break the
API of consuming apps and
is more intuitive as the
parameter is nullable.
This commit is contained in:
Krille 2023-04-28 09:15:12 +02:00
parent aa24c0ce66
commit 91617c1892
No known key found for this signature in database
3 changed files with 3 additions and 3 deletions

View File

@ -363,7 +363,7 @@ class Timeline {
} }
/// Set the read marker to the last synced event in this timeline. /// Set the read marker to the last synced event in this timeline.
Future<void> setReadMarker(String? eventId, {bool? public}) async { Future<void> setReadMarker({String? eventId, bool? public}) async {
eventId ??= eventId ??=
events.firstWhereOrNull((event) => event.status.isSynced)?.eventId; events.firstWhereOrNull((event) => event.status.isSynced)?.eventId;
if (eventId == null) return; if (eventId == null) return;

View File

@ -480,7 +480,7 @@ void main() {
await waitForCount(7); await waitForCount(7);
room.notificationCount = 1; room.notificationCount = 1;
await timeline.setReadMarker(null); await timeline.setReadMarker();
//expect(room.notificationCount, 0); //expect(room.notificationCount, 0);
}); });
test('sending an event and the http request finishes first, 0 -> 1 -> 2', test('sending an event and the http request finishes first, 0 -> 1 -> 2',

View File

@ -706,7 +706,7 @@ void main() {
)); ));
await Future.delayed(Duration(milliseconds: 50)); await Future.delayed(Duration(milliseconds: 50));
room.notificationCount = 1; room.notificationCount = 1;
await timeline.setReadMarker(null); await timeline.setReadMarker();
//expect(room.notificationCount, 0); //expect(room.notificationCount, 0);
}); });
test('sending an event and the http request finishes first, 0 -> 1 -> 2', test('sending an event and the http request finishes first, 0 -> 1 -> 2',