Move avatar color ID computation into SummaryData
This commit is contained in:
parent
dec0683145
commit
d0f70cbdf9
4 changed files with 2 additions and 16 deletions
|
@ -107,10 +107,6 @@ export class ArchivedRoom extends BaseRoom {
|
|||
this._emitUpdate();
|
||||
}
|
||||
|
||||
get avatarColorId() {
|
||||
return this._summary.data.avatarColorId;
|
||||
}
|
||||
|
||||
get isKicked() {
|
||||
return this._kickDetails?.membership === "leave";
|
||||
}
|
||||
|
|
|
@ -342,7 +342,7 @@ export class BaseRoom extends EventEmitter {
|
|||
}
|
||||
|
||||
get avatarColorId() {
|
||||
return this._heroes?.roomAvatarColorId || this._roomId
|
||||
return this._summary.data.avatarColorId;
|
||||
}
|
||||
|
||||
get lastMessageTimestamp() {
|
||||
|
|
|
@ -179,7 +179,6 @@ export class Invite extends EventEmitter {
|
|||
_createData(inviteState, myInvite, inviter, summaryData, heroes) {
|
||||
const name = heroes ? heroes.roomName : summaryData.name;
|
||||
const avatarUrl = heroes ? heroes.roomAvatarUrl : summaryData.avatarUrl;
|
||||
const avatarColorId = heroes ? heroes.roomAvatarColorId : summaryData.avatarColorId;
|
||||
return {
|
||||
roomId: this.id,
|
||||
isEncrypted: !!summaryData.encryption,
|
||||
|
@ -187,7 +186,7 @@ export class Invite extends EventEmitter {
|
|||
// type:
|
||||
name,
|
||||
avatarUrl,
|
||||
avatarColorId,
|
||||
avatarColorId: summaryData.avatarColorId,
|
||||
canonicalAlias: summaryData.canonicalAlias,
|
||||
timestamp: this._platform.clock.now(),
|
||||
joinRule: this._getJoinRule(inviteState),
|
||||
|
|
|
@ -97,13 +97,4 @@ export class Heroes {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
get roomAvatarColorId() {
|
||||
if (this._members.size === 1) {
|
||||
for (const member of this._members.values()) {
|
||||
return member.userId;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue