matrix.to urls for aliases don't need a via param

This commit is contained in:
jesopo 2022-08-10 15:54:06 +00:00
parent 625b62ce6d
commit 2136ef6ea5
2 changed files with 3 additions and 2 deletions

View File

@ -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, `<a href="${Permalinks.forRoom(alias, viaServers)}">${alias}</a>`);
const permalink = Permalinks.forRoom(alias, alias !== roomId ? [] : viaServers);
content.formatted_body = content.formatted_body.replace(regexRoomId, `<a href="${permalink}">${alias}</a>`);
}
}

View File

@ -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 <a href="https://matrix.to/#/${managementRoomAlias}?via=${ourHomeserver}">${managementRoomAlias}</a>`
`it's fun here in <a href="https://matrix.to/#/${managementRoomAlias}">${managementRoomAlias}</a>`
);
});
});