Use room alias in generated permalink for rooms

Signed-off-by: Simon Merrick <s.m3rrick@gmail.com>
This commit is contained in:
Simon Merrick 2020-11-28 21:50:51 +13:00
parent bb1d52919a
commit e92ac67152

View file

@ -130,7 +130,13 @@ export class RoomPermalinkCreator {
} }
forRoom() { forRoom() {
return getPermalinkConstructor().forRoom(this._roomId, this._serverCandidates); try {
// Prefer to use canonical alias for permalink if possible
const alias = this._room.getCanonicalAlias();
return getPermalinkConstructor().forRoom(alias, this._serverCandidates);
} catch (error) {
return getPermalinkConstructor().forRoom(this._roomId, this._serverCandidates);
}
} }
onRoomState(event) { onRoomState(event) {