Merge pull request #1989 from famedly/krille/follow-up-store-utd-events

chore: Follow up store unable to decrypt information correctly
This commit is contained in:
Krille-chan 2024-12-31 13:40:41 +01:00 committed by GitHub
commit 0caec7ca17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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,10 +163,17 @@ class Event extends MatrixEvent {
factory Event.fromMatrixEvent(
MatrixEvent matrixEvent,
Room room, {
EventStatus status = defaultStatus,
EventStatus? status,
}) =>
Event(
status: status,
matrixEvent is Event
? matrixEvent
: Event(
status: status ??
eventStatusFromInt(
matrixEvent.unsigned
?.tryGet<int>('messageSendingStatusKey') ??
defaultStatus.intValue,
),
content: matrixEvent.content,
type: matrixEvent.type,
eventId: matrixEvent.eventId,