diff --git a/lib/src/room.dart b/lib/src/room.dart index 20e8abc0..c7117716 100644 --- a/lib/src/room.dart +++ b/lib/src/room.dart @@ -188,7 +188,9 @@ class Room { state.relationshipType == RelationshipTypes.edit && lastEvent != null && !state.matchesEventOrTransactionId(lastEvent.eventId) && - lastEvent.eventId != state.relationshipEventId) { + lastEvent.eventId != state.relationshipEventId && + !(lastEvent.relationshipType == RelationshipTypes.edit && + lastEvent.relationshipEventId == state.relationshipEventId)) { return; } diff --git a/test/client_test.dart b/test/client_test.dart index 7c18bca8..521f20f6 100644 --- a/test/client_test.dart +++ b/test/client_test.dart @@ -492,6 +492,40 @@ void main() { } })); expect(room.getState('m.room.message')!.content['body'], '* floooof'); + + // accepts a consecutive edit + await matrix.handleSync(SyncUpdate.fromJson({ + 'next_batch': 'fakesync', + 'rooms': { + 'join': { + roomId: { + 'timeline': { + 'events': [ + { + 'sender': '@alice:example.com', + 'type': 'm.room.message', + 'content': { + 'msgtype': 'm.text', + 'body': '* foxies', + 'm.new_content': { + 'msgtype': 'm.text', + 'body': 'foxies', + }, + 'm.relates_to': { + 'rel_type': 'm.replace', + 'event_id': '\$last:example.com' + }, + }, + 'origin_server_ts': 1417731086799, + 'event_id': '\$edit2:example.com' + } + ] + } + } + } + } + })); + expect(room.getState('m.room.message')!.content['body'], '* foxies'); }); test('getProfileFromUserId', () async {