From 2136ef6ea5ddbef388039df1bf6223a5282e944c Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 10 Aug 2022 15:54:06 +0000 Subject: [PATCH] matrix.to urls for aliases don't need a `via` param --- src/utils.ts | 3 ++- test/integration/utilsTest.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index 7d31538..8c6ad25 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -226,7 +226,8 @@ export async function replaceRoomIdsWithPills(mjolnir: Mjolnir, text: string, ro const regexRoomId = new RegExp(escapeRegex(roomId), "g"); content.body = content.body.replace(regexRoomId, alias); if (content.formatted_body) { - content.formatted_body = content.formatted_body.replace(regexRoomId, `${alias}`); + const permalink = Permalinks.forRoom(alias, alias !== roomId ? [] : viaServers); + content.formatted_body = content.formatted_body.replace(regexRoomId, `${alias}`); } } diff --git a/test/integration/utilsTest.ts b/test/integration/utilsTest.ts index fa68ea1..24c3823 100644 --- a/test/integration/utilsTest.ts +++ b/test/integration/utilsTest.ts @@ -26,7 +26,7 @@ describe("Test: utils", function() { const ourHomeserver = new UserID(await this.mjolnir.client.getUserId()).domain; assert.equal( out.formatted_body, - `it's fun here in ${managementRoomAlias}` + `it's fun here in ${managementRoomAlias}` ); }); });