mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
Room.name can actually return null now
so protect against this, and fall back to "Empty Room"
This commit is contained in:
parent
e4758d0651
commit
b39c15d88d
@ -84,7 +84,7 @@ export class RoomViewModel extends ViewModel {
|
||||
}
|
||||
|
||||
get name() {
|
||||
return this._room.name;
|
||||
return this._room.name || this.i18n`Empty Room`;
|
||||
}
|
||||
|
||||
get timelineViewModel() {
|
||||
@ -102,7 +102,7 @@ export class RoomViewModel extends ViewModel {
|
||||
}
|
||||
|
||||
get avatarLetter() {
|
||||
return avatarInitials(this._room.name);
|
||||
return avatarInitials(this.name);
|
||||
}
|
||||
|
||||
get avatarColorNumber() {
|
||||
|
@ -70,7 +70,7 @@ export class RoomTileViewModel extends ViewModel {
|
||||
const timeDiff = theirTimestamp - myTimestamp;
|
||||
if (timeDiff === 0) {
|
||||
// sort alphabetically
|
||||
const nameCmp = this._room.name.localeCompare(other._room.name);
|
||||
const nameCmp = this.name.localeCompare(other.name);
|
||||
if (nameCmp === 0) {
|
||||
return this._room.id.localeCompare(other._room.id);
|
||||
}
|
||||
@ -88,12 +88,12 @@ export class RoomTileViewModel extends ViewModel {
|
||||
}
|
||||
|
||||
get name() {
|
||||
return this._room.name;
|
||||
return this._room.name || this.i18n`Empty Room`;
|
||||
}
|
||||
|
||||
// Avatar view model contract
|
||||
get avatarLetter() {
|
||||
return avatarInitials(this._room.name);
|
||||
return avatarInitials(this.name);
|
||||
}
|
||||
|
||||
get avatarColorNumber() {
|
||||
|
Loading…
Reference in New Issue
Block a user