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 && if (event is MatrixEvent &&
event.type == EventTypes.Encrypted && event.type == EventTypes.Encrypted &&
encryptionEnabled) { encryptionEnabled) {
final decrypted = await encryption!.decryptRoomEvent( event = await encryption!.decryptRoomEvent(
Event.fromMatrixEvent(event, room), Event.fromMatrixEvent(event, room),
updateType: type, updateType: type,
); );
if (decrypted.type != EventTypes.Encrypted) { if (event.type == EventTypes.Encrypted) {
event = decrypted;
} else {
// if the event failed to decrypt, add it to the queue // if the event failed to decrypt, add it to the queue
_eventsPendingDecryption.add( _eventsPendingDecryption.add(
_EventPendingDecryption(Event.fromMatrixEvent(event, room)), _EventPendingDecryption(Event.fromMatrixEvent(event, room)),

View File

@ -163,10 +163,17 @@ class Event extends MatrixEvent {
factory Event.fromMatrixEvent( factory Event.fromMatrixEvent(
MatrixEvent matrixEvent, MatrixEvent matrixEvent,
Room room, { Room room, {
EventStatus status = defaultStatus, EventStatus? status,
}) => }) =>
Event( matrixEvent is Event
status: status, ? matrixEvent
: Event(
status: status ??
eventStatusFromInt(
matrixEvent.unsigned
?.tryGet<int>('messageSendingStatusKey') ??
defaultStatus.intValue,
),
content: matrixEvent.content, content: matrixEvent.content,
type: matrixEvent.type, type: matrixEvent.type,
eventId: matrixEvent.eventId, eventId: matrixEvent.eventId,