fix: Change eventstatus of edits in prevEvent
Unfortunately the last fix was not working. This fixes it for real now and also adds a test case to make sure it never breaks again.
This commit is contained in:
parent
5f448020af
commit
f052957c0a
|
|
@ -187,7 +187,8 @@ class Room {
|
||||||
state.relationshipEventId != null &&
|
state.relationshipEventId != null &&
|
||||||
state.relationshipType == RelationshipTypes.edit &&
|
state.relationshipType == RelationshipTypes.edit &&
|
||||||
lastEvent != null &&
|
lastEvent != null &&
|
||||||
!lastEvent.matchesEventOrTransactionId(state.relationshipEventId)) {
|
!state.matchesEventOrTransactionId(lastEvent.eventId) &&
|
||||||
|
lastEvent.eventId != state.relationshipEventId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -234,9 +234,35 @@ void main() {
|
||||||
'm.relates_to': {'rel_type': 'm.replace', 'event_id': '2'},
|
'm.relates_to': {'rel_type': 'm.replace', 'event_id': '2'},
|
||||||
},
|
},
|
||||||
stateKey: '',
|
stateKey: '',
|
||||||
|
status: EventStatus.sending,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
expect(room.lastEvent?.body, 'edited cdc');
|
expect(room.lastEvent?.body, 'edited cdc');
|
||||||
|
expect(room.lastEvent?.status, EventStatus.sending);
|
||||||
|
expect(room.lastEvent?.eventId, '4');
|
||||||
|
|
||||||
|
// Status update on edits working?
|
||||||
|
room.setState(
|
||||||
|
Event(
|
||||||
|
senderId: '@test:example.com',
|
||||||
|
type: 'm.room.encrypted',
|
||||||
|
room: room,
|
||||||
|
eventId: '5',
|
||||||
|
unsigned: {'transaction_id': '4'},
|
||||||
|
originServerTs: DateTime.now(),
|
||||||
|
content: {
|
||||||
|
'msgtype': 'm.text',
|
||||||
|
'body': 'edited cdc',
|
||||||
|
'm.new_content': {'msgtype': 'm.text', 'body': 'edited cdc'},
|
||||||
|
'm.relates_to': {'rel_type': 'm.replace', 'event_id': '2'},
|
||||||
|
},
|
||||||
|
stateKey: '',
|
||||||
|
status: EventStatus.sent,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
expect(room.lastEvent?.eventId, '5');
|
||||||
|
expect(room.lastEvent?.body, 'edited cdc');
|
||||||
|
expect(room.lastEvent?.status, EventStatus.sent);
|
||||||
});
|
});
|
||||||
test('lastEvent when reply parent edited', () async {
|
test('lastEvent when reply parent edited', () async {
|
||||||
room.setState(
|
room.setState(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue