You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-08-06 12:02:40 +03:00
Revert "room name should only take canonical alias into account"
This commit is contained in:
@@ -863,24 +863,24 @@ describe("Room", function() {
|
||||
expect(name.indexOf(userB)).toNotEqual(-1, name);
|
||||
});
|
||||
|
||||
it("should not show the room alias if one exists for private " +
|
||||
it("should show the room alias if one exists for private " +
|
||||
"(invite join_rules) rooms if a room name doesn't exist.", function() {
|
||||
const alias = "#room_alias:here";
|
||||
setJoinRule("invite");
|
||||
setAliases([alias, "#another:one"]);
|
||||
room.recalculate();
|
||||
const name = room.name;
|
||||
expect(name).toEqual("Empty room");
|
||||
expect(name).toEqual(alias);
|
||||
});
|
||||
|
||||
it("should not show the room alias if one exists for public " +
|
||||
it("should show the room alias if one exists for public " +
|
||||
"(public join_rules) rooms if a room name doesn't exist.", function() {
|
||||
const alias = "#room_alias:here";
|
||||
setJoinRule("public");
|
||||
setAliases([alias, "#another:one"]);
|
||||
room.recalculate();
|
||||
const name = room.name;
|
||||
expect(name).toEqual("Empty room");
|
||||
expect(name).toEqual(alias);
|
||||
});
|
||||
|
||||
it("should show the room name if one exists for private " +
|
||||
|
@@ -1525,7 +1525,15 @@ function calculateRoomName(room, userId, ignoreRoomNameEvent) {
|
||||
}
|
||||
}
|
||||
|
||||
const alias = room.getCanonicalAlias();
|
||||
let alias = room.getCanonicalAlias();
|
||||
|
||||
if (!alias) {
|
||||
const aliases = room.getAliases();
|
||||
|
||||
if (aliases.length) {
|
||||
alias = aliases[0];
|
||||
}
|
||||
}
|
||||
if (alias) {
|
||||
return alias;
|
||||
}
|
||||
|
Reference in New Issue
Block a user