Merge branch 'henri/fix-remove-duplicated-fully-read' into 'main'

fix: remove duplicated read marker

See merge request famedly/company/frontend/famedlysdk!1033
This commit is contained in:
Henri Carnot 2022-05-16 11:09:37 +00:00
commit 7e4096cc63
2 changed files with 4 additions and 9 deletions

View File

@ -198,7 +198,7 @@ class Room {
/// ID of the fully read marker event.
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
/// room id.
@ -1195,13 +1195,8 @@ class Room {
}
/// Get the user fully read marker
String? get userFullyReadMarker {
final readEvent = roomAccountData['m.fully_read'];
if (readEvent != null) {
return readEvent.content.tryGet<String>('event_id');
}
return null;
}
@Deprecated('Use fullyRead marker')
String? get userFullyReadMarker => fullyRead;
/// Sets the position of the read marker for a given room, and optionally the
/// read receipt's location.

View File

@ -98,7 +98,7 @@ void main() {
expect(
room.getState('m.room.join_rules')?.content['join_rule'], 'public');
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(
Event(