Move avatar color ID computation into SummaryData

This commit is contained in:
Danila Fedorin 2021-06-29 18:01:08 -07:00
parent dec0683145
commit d0f70cbdf9
4 changed files with 2 additions and 16 deletions

View file

@ -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";
}

View file

@ -342,7 +342,7 @@ export class BaseRoom extends EventEmitter {
}
get avatarColorId() {
return this._heroes?.roomAvatarColorId || this._roomId
return this._summary.data.avatarColorId;
}
get lastMessageTimestamp() {

View file

@ -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),

View file

@ -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;
}
}