From 4f7468a95af24b82b15244dfec2c2bc4ab23fb72 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Tue, 30 Nov 2021 15:35:29 +0000 Subject: [PATCH] compare(): Add checks for 'ph-123' room IDs These will be used to place placeholders correctly. --- src/matrix/Sync3.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/matrix/Sync3.ts b/src/matrix/Sync3.ts index d6ae3407..5c88d973 100644 --- a/src/matrix/Sync3.ts +++ b/src/matrix/Sync3.ts @@ -159,8 +159,14 @@ export class Sync3 { if (roomIdA === roomIdB) { return 0; } - const indexA = this.roomIdToRoomIndex[roomIdA]; - const indexB = this.roomIdToRoomIndex[roomIdB]; + let indexA = this.roomIdToRoomIndex[roomIdA]; + let indexB = this.roomIdToRoomIndex[roomIdB]; + if (indexA === undefined && roomIdA.startsWith("ph-")) { + indexA = Number(roomIdA.substr(3)); + } + if (indexB === undefined && roomIdB.startsWith("ph-")) { + indexB = Number(roomIdB.substr(3)); + } if (indexA === undefined || indexB === undefined) { console.error("sync3 cannot compare: missing indices for rooms", roomIdA, roomIdB, indexA, indexB); }