Fallback to room name "empty room"
All checks were successful
continuous-integration/drone/push Build is passing

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

View file

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