fix: remove duplicated read marker

This commit is contained in:
h.carnot 2022-05-11 10:30:21 +02:00
parent d09ed915bc
commit 6c2e525a64
2 changed files with 4 additions and 9 deletions

View File

@ -195,7 +195,7 @@ class Room {
/// ID of the fully read marker event. /// ID of the fully read marker event.
String get fullyRead => String get fullyRead =>
roomAccountData['m.fully_read']?.content['event_id'] ?? ''; roomAccountData['m.fully_read']?.content.tryGet<String>('event_id') ?? '';
/// If something changes, this callback will be triggered. Will return the /// If something changes, this callback will be triggered. Will return the
/// room id. /// room id.
@ -1192,13 +1192,8 @@ class Room {
} }
/// Get the user fully read marker /// Get the user fully read marker
String? get userFullyReadMarker { @Deprecated('Use fullyRead marker')
final readEvent = roomAccountData['m.fully_read']; String? get userFullyReadMarker => fullyRead;
if (readEvent != null) {
return readEvent.content.tryGet<String>('event_id');
}
return null;
}
/// Sets the position of the read marker for a given room, and optionally the /// Sets the position of the read marker for a given room, and optionally the
/// read receipt's location. /// read receipt's location.

View File

@ -98,7 +98,7 @@ void main() {
expect( expect(
room.getState('m.room.join_rules')?.content['join_rule'], 'public'); room.getState('m.room.join_rules')?.content['join_rule'], 'public');
expect(room.roomAccountData['com.test.foo']?.content['foo'], 'bar'); expect(room.roomAccountData['com.test.foo']?.content['foo'], 'bar');
expect(room.userFullyReadMarker, '\$event_id:example.com'); expect(room.fullyRead, '\$event_id:example.com');
room.setState( room.setState(
Event( Event(