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,20 +163,27 @@ 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
content: matrixEvent.content, : Event(
type: matrixEvent.type, status: status ??
eventId: matrixEvent.eventId, eventStatusFromInt(
senderId: matrixEvent.senderId, matrixEvent.unsigned
originServerTs: matrixEvent.originServerTs, ?.tryGet<int>('messageSendingStatusKey') ??
unsigned: matrixEvent.unsigned, defaultStatus.intValue,
prevContent: matrixEvent.prevContent, ),
stateKey: matrixEvent.stateKey, content: matrixEvent.content,
room: room, 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. /// Get a State event from a table row or from the event stream.
factory Event.fromJson( factory Event.fromJson(