From c638e50e505c8148069a2b212d834e80a00db139 Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Fri, 25 Nov 2022 00:43:52 -0500 Subject: [PATCH 1/2] Refresh joined rooms when enabling crypto When enabling crypto on an Intent, refresh its list of joined rooms, as it's used to determine which rooms to watch for crypto updates. This fixes an issue where a restart would cause Intents to lose track of which rooms they were joined to, until the list is refreshed either manually or in response to a membership event. Signed-off-by: Andrew Ferrazzutti --- src/appservice/Intent.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/appservice/Intent.ts b/src/appservice/Intent.ts index 12f61a33..01f46e2a 100644 --- a/src/appservice/Intent.ts +++ b/src/appservice/Intent.ts @@ -170,6 +170,7 @@ export class Intent { // Now set up crypto await this.client.crypto.prepare(await this.client.getJoinedRooms()); + await this.refreshJoinedRooms(); this.appservice.on("room.event", (roomId, event) => { if (!this.knownJoinedRooms.includes(roomId)) return; this.client.crypto.onRoomEvent(roomId, event); From d0449ecebb03619a5b8480ba986743b984116b10 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 19 Dec 2022 16:02:59 -0700 Subject: [PATCH 2/2] Update src/appservice/Intent.ts --- src/appservice/Intent.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/appservice/Intent.ts b/src/appservice/Intent.ts index 01f46e2a..ab41261f 100644 --- a/src/appservice/Intent.ts +++ b/src/appservice/Intent.ts @@ -168,9 +168,8 @@ export class Intent { } // Now set up crypto - await this.client.crypto.prepare(await this.client.getJoinedRooms()); + await this.client.crypto.prepare(await this.refreshJoinedRooms()); - await this.refreshJoinedRooms(); this.appservice.on("room.event", (roomId, event) => { if (!this.knownJoinedRooms.includes(roomId)) return; this.client.crypto.onRoomEvent(roomId, event);