From fd7114fd7d8d36d211936d2892baf6d94155cdd4 Mon Sep 17 00:00:00 2001 From: gnuxie Date: Tue, 17 Sep 2024 12:00:33 +0100 Subject: [PATCH] Skip calling `/join` for rooms we arleady know we are joined to. https://github.com/Gnuxie/matrix-protection-suite/issues/61 https://github.com/the-draupnir-project/Draupnir/issues/561 --- package.json | 4 ++-- src/draupnirfactory/DraupnirFactory.ts | 12 ++++++------ yarn.lock | 16 ++++++++-------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 0c737083..cd3e219f 100644 --- a/package.json +++ b/package.json @@ -69,8 +69,8 @@ "js-yaml": "^4.1.0", "jsdom": "^24.0.0", "matrix-appservice-bridge": "^9.0.1", - "matrix-protection-suite": "npm:@gnuxie/matrix-protection-suite@1.3.0", - "matrix-protection-suite-for-matrix-bot-sdk": "npm:@gnuxie/matrix-protection-suite-for-matrix-bot-sdk@1.3.0", + "matrix-protection-suite": "npm:@gnuxie/matrix-protection-suite@1.4.0", + "matrix-protection-suite-for-matrix-bot-sdk": "npm:@gnuxie/matrix-protection-suite-for-matrix-bot-sdk@1.4.0", "parse-duration": "^1.0.2", "pg": "^8.8.0", "shell-quote": "^1.7.3", diff --git a/src/draupnirfactory/DraupnirFactory.ts b/src/draupnirfactory/DraupnirFactory.ts index a18dcb3e..5567f014 100644 --- a/src/draupnirfactory/DraupnirFactory.ts +++ b/src/draupnirfactory/DraupnirFactory.ts @@ -37,12 +37,6 @@ export class DraupnirFactory { managementRoom: MatrixRoomID, config: IConfig ): Promise> { - const roomStateManager = - await this.roomStateManagerFactory.getRoomStateManager(clientUserID); - const policyRoomManager = - await this.roomStateManagerFactory.getPolicyRoomManager(clientUserID); - const roomMembershipManager = - await this.roomStateManagerFactory.getRoomMembershipManager(clientUserID); const client = await this.clientProvider(clientUserID); const clientRooms = await this.clientsInRoomMap.makeClientRooms( clientUserID, @@ -51,6 +45,12 @@ export class DraupnirFactory { if (isError(clientRooms)) { return clientRooms; } + const roomStateManager = + await this.roomStateManagerFactory.getRoomStateManager(clientUserID); + const policyRoomManager = + await this.roomStateManagerFactory.getPolicyRoomManager(clientUserID); + const roomMembershipManager = + await this.roomStateManagerFactory.getRoomMembershipManager(clientUserID); const clientPlatform = this.clientCapabilityFactory.makeClientPlatform( clientUserID, client diff --git a/yarn.lock b/yarn.lock index 47b779b5..9ab1a56b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2526,17 +2526,17 @@ matrix-appservice@^2.0.0: request-promise "^4.2.6" sanitize-html "^2.8.0" -"matrix-protection-suite-for-matrix-bot-sdk@npm:@gnuxie/matrix-protection-suite-for-matrix-bot-sdk@1.3.0": - version "1.3.0" - resolved "https://registry.yarnpkg.com/@gnuxie/matrix-protection-suite-for-matrix-bot-sdk/-/matrix-protection-suite-for-matrix-bot-sdk-1.3.0.tgz#2efc303e9e43787e1eee7624cec9b37bfe954f4b" - integrity sha512-6tRMml+1+c4dBLqXKCWwpaESVtnDFQO6dC/AqTQCvij610bp5dQQFIdraGyKS+XNj7bm2AEJK/VAk6xQusmz+Q== +"matrix-protection-suite-for-matrix-bot-sdk@npm:@gnuxie/matrix-protection-suite-for-matrix-bot-sdk@1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@gnuxie/matrix-protection-suite-for-matrix-bot-sdk/-/matrix-protection-suite-for-matrix-bot-sdk-1.4.0.tgz#0745358810e03959344e791733e6ccb7e811689d" + integrity sha512-xGkBaBdZ3u5Z27HqG2IEPxQ8Z5slFtWCihnFzocPBtRcLDJMFXnoF1+bpWElnPomDQtw/u0gvDwSC+f4pmTqyQ== dependencies: "@gnuxie/typescript-result" "^1.0.0" -"matrix-protection-suite@npm:@gnuxie/matrix-protection-suite@1.3.0": - version "1.3.0" - resolved "https://registry.yarnpkg.com/@gnuxie/matrix-protection-suite/-/matrix-protection-suite-1.3.0.tgz#b6df1352b6dd62876690444ba5a8257aa9f1cb52" - integrity sha512-Gn6OeHC92PNcUQH4azN1rK12aywqcOey5dXsJEK00a7PZDseZE2EkATmhjABfptmSNTb/WRqkOi+xmdFi9bLrA== +"matrix-protection-suite@npm:@gnuxie/matrix-protection-suite@1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@gnuxie/matrix-protection-suite/-/matrix-protection-suite-1.4.0.tgz#0cce6f9dec22cf41b8ffc26861e5ae5c7cf463db" + integrity sha512-/1+L/Tf/fJx9aeNvyIfF4dqkS6YtTkRLMvSiqFNIpCq3JxOwyM2nqVBBNG5rbVPPdrxGlaFP+GuPxAUm54SdSA== dependencies: "@gnuxie/typescript-result" "^1.0.0" await-lock "^2.2.2"