fix: Store decrypted last event in store

This commit is contained in:
Krille Fear 2022-12-20 20:29:42 +01:00 committed by Christian Pauly
parent 5c7966f3a2
commit 49703f5808
1 changed files with 14 additions and 0 deletions

View File

@ -190,7 +190,21 @@ class KeyManager {
event.content['session_id'] == sessionId) {
final decrypted = encryption.decryptRoomEventSync(roomId, event);
if (decrypted.type != EventTypes.Encrypted) {
// Set the decrypted event as last event by adding it to the state
room.setState(decrypted);
// Also store in database
final database = client.database;
if (database != null) {
await database.transaction(() async {
await database.storeEventUpdate(
EventUpdate(
roomID: room.id,
type: EventUpdateType.state,
content: decrypted.toJson(),
),
client);
});
}
}
}
// and finally broadcast the new session