Merge branch 'krille/store-after-decrypted-last-event' into 'main'
fix: Store decrypted last event in store See merge request famedly/company/frontend/famedlysdk!1197
This commit is contained in:
commit
9d9b1e38ec
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue