Fallback to room name "empty room"
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Cadence Ember 2020-10-22 20:56:27 +13:00
parent 9e71336c5b
commit e18c8c77ae
Signed by: cadence
GPG Key ID: BC1C2C61CF521B17
1 changed files with 6 additions and 2 deletions

View File

@ -106,8 +106,12 @@ class Room extends ElemJS {
}
// if the room has no alias, use the names of its members ("heroes")
const users = this.data.summary["m.heroes"]
const usernames = users.map(u => (u.match(/^@([^:]+):/) || [])[1] || u)
return usernames.join(", ")
if (users && users.length) {
const usernames = users.map(u => (u.match(/^@([^:]+):/) || [])[1] || u)
return usernames.join(", ")
}
// the room is empty
return "Empty room"
}
getIcon() {