diff --git a/src/domain/session/rightpanel/RoomDetailsViewModel.js b/src/domain/session/rightpanel/RoomDetailsViewModel.js index 911e5945..b9f05835 100644 --- a/src/domain/session/rightpanel/RoomDetailsViewModel.js +++ b/src/domain/session/rightpanel/RoomDetailsViewModel.js @@ -34,7 +34,7 @@ export class RoomDetailsViewModel extends ViewModel { } get avatarColorNumber() { - return getIdentifierColorNumber(this.roomId) + return getIdentifierColorNumber(this._room.avatarColorId) } avatarUrl(size) { diff --git a/src/domain/session/room/RoomViewModel.js b/src/domain/session/room/RoomViewModel.js index 4d53ec6c..38835db3 100644 --- a/src/domain/session/room/RoomViewModel.js +++ b/src/domain/session/room/RoomViewModel.js @@ -119,7 +119,7 @@ export class RoomViewModel extends ViewModel { } get avatarColorNumber() { - return getIdentifierColorNumber(this._room.id) + return getIdentifierColorNumber(this._room.avatarColorId) } avatarUrl(size) { diff --git a/src/matrix/room/Room.js b/src/matrix/room/Room.js index 482d167f..5e002411 100644 --- a/src/matrix/room/Room.js +++ b/src/matrix/room/Room.js @@ -328,6 +328,10 @@ export class Room extends BaseRoom { }); } + get avatarColorId() { + return this._heroes?.roomAvatarColorId || this._roomId + } + get isUnread() { return this._summary.data.isUnread; } diff --git a/src/matrix/room/members/Heroes.js b/src/matrix/room/members/Heroes.js index f6ad3085..6336cda2 100644 --- a/src/matrix/room/members/Heroes.js +++ b/src/matrix/room/members/Heroes.js @@ -97,4 +97,13 @@ export class Heroes { } return null; } + + get roomAvatarColorId() { + if (this._members.size === 1) { + for (const member of this._members.values()) { + return member.userId; + } + } + return null; + } }