From 9f716d1ea4c98883c5af7610dda9d2ca035e5aa7 Mon Sep 17 00:00:00 2001 From: Dale Fukami Date: Tue, 17 Oct 2023 09:44:09 -0600 Subject: [PATCH] Force decrypt the events before we start processing the rooms --- src/lib/chat/matrix-client.test.ts | 1 + src/lib/chat/matrix-client.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/lib/chat/matrix-client.test.ts b/src/lib/chat/matrix-client.test.ts index dbbf8b5e7..cae5e79c0 100644 --- a/src/lib/chat/matrix-client.test.ts +++ b/src/lib/chat/matrix-client.test.ts @@ -18,6 +18,7 @@ const stubRoom = (attrs = {}) => ({ getMembers: () => [], getDMInviter: () => undefined, loadMembersIfNeeded: () => undefined, + decryptAllEvents: () => undefined, getLiveTimeline: () => stubTimeline(), getMyMembership: () => 'join', getEvents: () => stubTimeline(), diff --git a/src/lib/chat/matrix-client.ts b/src/lib/chat/matrix-client.ts index 60cc1a171..a0ab1c050 100644 --- a/src/lib/chat/matrix-client.ts +++ b/src/lib/chat/matrix-client.ts @@ -96,6 +96,7 @@ export class MatrixClient implements IChatClient { await this.waitForConnection(); const rooms = await this.getFilteredRooms(this.isChannel); for (const room of rooms) { + await room.decryptAllEvents(); await room.loadMembersIfNeeded(); } @@ -108,6 +109,7 @@ export class MatrixClient implements IChatClient { const failedToJoin = []; for (const room of rooms) { + await room.decryptAllEvents(); await room.loadMembersIfNeeded(); const membership = room.getMyMembership(); if (membership === MembershipStateType.Invite) {