fix: Event statuses progress and are saved correctly
This commit is contained in:
parent
cbc66ea308
commit
20d72eb8d7
|
@ -424,6 +424,7 @@ class Database extends _$Database {
|
|||
|
||||
// is there a transaction id? Then delete the event with this id.
|
||||
if (status != -1 &&
|
||||
status != 0 &&
|
||||
eventUpdate.content['unsigned'] is Map &&
|
||||
eventUpdate.content['unsigned']['transaction_id'] is String) {
|
||||
await removeEvent(clientId,
|
||||
|
|
|
@ -211,7 +211,11 @@ class Timeline {
|
|||
if (eventUpdate.roomID != room.id) return;
|
||||
|
||||
if (eventUpdate.type == 'timeline' || eventUpdate.type == 'history') {
|
||||
var status = eventUpdate.content['status'] ?? 2;
|
||||
var status = eventUpdate.content['status'] ??
|
||||
(eventUpdate.content['unsigned'] is Map<String, dynamic>
|
||||
? eventUpdate.content['unsigned'][MessageSendingStatusKey]
|
||||
: null) ??
|
||||
2;
|
||||
// Redaction events are handled as modification for existing events.
|
||||
if (eventUpdate.eventType == EventTypes.Redaction) {
|
||||
final eventId = _findEvent(event_id: eventUpdate.content['redacts']);
|
||||
|
|
|
@ -371,9 +371,12 @@ void main() {
|
|||
'type': 'm.room.message',
|
||||
'content': {'msgtype': 'm.text', 'body': 'Testcase'},
|
||||
'sender': '@alice:example.com',
|
||||
'status': 0,
|
||||
'event_id': 'transaction',
|
||||
'origin_server_ts': testTimeStamp
|
||||
'origin_server_ts': testTimeStamp,
|
||||
'unsigned': {
|
||||
MessageSendingStatusKey: 0,
|
||||
'transaction_id': 'transaction',
|
||||
},
|
||||
},
|
||||
sortOrder: room.newSortOrder));
|
||||
await Future.delayed(Duration(milliseconds: 50));
|
||||
|
@ -387,10 +390,12 @@ void main() {
|
|||
'type': 'm.room.message',
|
||||
'content': {'msgtype': 'm.text', 'body': 'Testcase'},
|
||||
'sender': '@alice:example.com',
|
||||
'status': 2,
|
||||
'event_id': '\$event',
|
||||
'origin_server_ts': testTimeStamp,
|
||||
'unsigned': {'transaction_id': 'transaction'}
|
||||
'unsigned': {
|
||||
'transaction_id': 'transaction',
|
||||
MessageSendingStatusKey: 2,
|
||||
},
|
||||
},
|
||||
sortOrder: room.newSortOrder));
|
||||
await Future.delayed(Duration(milliseconds: 50));
|
||||
|
@ -404,10 +409,12 @@ void main() {
|
|||
'type': 'm.room.message',
|
||||
'content': {'msgtype': 'm.text', 'body': 'Testcase'},
|
||||
'sender': '@alice:example.com',
|
||||
'status': 1,
|
||||
'event_id': '\$event',
|
||||
'origin_server_ts': testTimeStamp,
|
||||
'unsigned': {'transaction_id': 'transaction'}
|
||||
'unsigned': {
|
||||
'transaction_id': 'transaction',
|
||||
MessageSendingStatusKey: 1,
|
||||
},
|
||||
},
|
||||
sortOrder: room.newSortOrder));
|
||||
await Future.delayed(Duration(milliseconds: 50));
|
||||
|
|
Loading…
Reference in a new issue