[Room] Fix relates to key while encryption

This commit is contained in:
Christian Pauly 2020-04-20 10:56:36 +00:00
parent a4e75cb6f2
commit 69b13bb24d
1 changed files with 6 additions and 0 deletions

View File

@ -1668,6 +1668,7 @@ class Room {
if (_outboundGroupSession == null) {
await createOutboundGroupSession();
}
final Map<String, dynamic> mRelatesTo = payload.remove('m.relates_to');
final payloadContent = {
'content': payload,
'type': type,
@ -1679,6 +1680,7 @@ class Room {
'device_id': client.deviceID,
'sender_key': client.identityKey,
'session_id': _outboundGroupSession.session_id(),
if (mRelatesTo != null) 'm.relates_to': mRelatesTo,
};
await _storeOutboundGroupSession();
return encryptedPayload;
@ -1736,6 +1738,10 @@ class Room {
};
}
}
if (event.content['m.relates_to'] != null) {
decryptedPayload['content']['m.relates_to'] =
event.content['m.relates_to'];
}
return Event(
content: decryptedPayload['content'],
typeKey: decryptedPayload['type'],