Bump bot-sdk version to handle published aliases better

This commit is contained in:
Travis Ralston
2020-05-11 21:31:47 -06:00
parent 9e18a6dfff
commit 46bc6a1a0f
3 changed files with 6 additions and 21 deletions
+1 -1
View File
@@ -27,6 +27,6 @@
"config": "^3.3.1",
"escape-html": "^1.0.3",
"js-yaml": "^3.13.1",
"matrix-bot-sdk": "^0.5.3"
"matrix-bot-sdk": "^0.5.4"
}
}
+1 -16
View File
@@ -187,7 +187,7 @@ export async function replaceRoomIdsWithPills(client: MatrixClient, text: string
for (const roomId of roomIds) {
let alias = roomId;
try {
alias = (await getRoomAlias(client, roomId)) || roomId;
alias = (await client.getPublishedAlias(roomId)) || roomId;
} catch (e) {
// This is a recursive call, so tell the function not to try and call us
await logMessage(LogLevel.WARN, "utils", `Failed to resolve room alias for ${roomId} - see console for details`, null, true);
@@ -200,18 +200,3 @@ export async function replaceRoomIdsWithPills(client: MatrixClient, text: string
return content;
}
// TODO: Merge this function into js-bot-sdk
export async function getRoomAlias(client: MatrixClient, roomId: string): Promise<string> {
try {
const event = await client.getRoomStateEvent(roomId, "m.room.canonical_alias", "");
if (!event) return null;
const canonical = event['alias'];
const alt = event['alt_aliases'] || [];
return canonical || alt[0];
} catch (e) {
return null; // assume none
}
}
+4 -4
View File
@@ -1704,10 +1704,10 @@ map-visit@^1.0.0:
dependencies:
object-visit "^1.0.0"
matrix-bot-sdk@^0.5.3:
version "0.5.3"
resolved "https://registry.yarnpkg.com/matrix-bot-sdk/-/matrix-bot-sdk-0.5.3.tgz#ec01a76a9ec9d120cee4461dda3b0db01e8a32de"
integrity sha512-jmoU55HbJpvTopZrjMca5u7jmfW3j/Fc3vPExs+5RRqFNCChT/TYQxr7PXD9Ho96YbL7zJ3zynOZ3fXvHg4hYA==
matrix-bot-sdk@^0.5.4:
version "0.5.4"
resolved "https://registry.yarnpkg.com/matrix-bot-sdk/-/matrix-bot-sdk-0.5.4.tgz#8c26bef826bd0b3fc9b693c8d07b52c30d843fd7"
integrity sha512-nUAE1WW7ast+Xsfux1+qBPmKSY6OG0RoZfeh0WfMP42JW6GRnNiY3hq7aiifomnJAMASZ6EwkdHS3ChWpIRYzg==
dependencies:
"@types/express" "^4.17.2"
chalk "^3.0.0"