chore: Follow up store unable to decrypt information correctly

This commit is contained in:
Krille 2024-12-31 12:51:02 +01:00
parent d89c8a3b54
commit 632ecbed7e
No known key found for this signature in database
GPG Key ID: E067ECD60F1A0652
2 changed files with 22 additions and 17 deletions

View File

@ -2755,14 +2755,12 @@ class Client extends MatrixApi {
if (event is MatrixEvent &&
event.type == EventTypes.Encrypted &&
encryptionEnabled) {
final decrypted = await encryption!.decryptRoomEvent(
event = await encryption!.decryptRoomEvent(
Event.fromMatrixEvent(event, room),
updateType: type,
);
if (decrypted.type != EventTypes.Encrypted) {
event = decrypted;
} else {
if (event.type == EventTypes.Encrypted) {
// if the event failed to decrypt, add it to the queue
_eventsPendingDecryption.add(
_EventPendingDecryption(Event.fromMatrixEvent(event, room)),

View File

@ -163,20 +163,27 @@ class Event extends MatrixEvent {
factory Event.fromMatrixEvent(
MatrixEvent matrixEvent,
Room room, {
EventStatus status = defaultStatus,
EventStatus? status,
}) =>
Event(
status: status,
content: matrixEvent.content,
type: matrixEvent.type,
eventId: matrixEvent.eventId,
senderId: matrixEvent.senderId,
originServerTs: matrixEvent.originServerTs,
unsigned: matrixEvent.unsigned,
prevContent: matrixEvent.prevContent,
stateKey: matrixEvent.stateKey,
room: room,
);
matrixEvent is Event
? matrixEvent
: Event(
status: status ??
eventStatusFromInt(
matrixEvent.unsigned
?.tryGet<int>('messageSendingStatusKey') ??
defaultStatus.intValue,
),
content: matrixEvent.content,
type: matrixEvent.type,
eventId: matrixEvent.eventId,
senderId: matrixEvent.senderId,
originServerTs: matrixEvent.originServerTs,
unsigned: matrixEvent.unsigned,
prevContent: matrixEvent.prevContent,
stateKey: matrixEvent.stateKey,
room: room,
);
/// Get a State event from a table row or from the event stream.
factory Event.fromJson(