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(); this._emitUpdate();
} }
get avatarColorId() {
return this._summary.data.avatarColorId;
}
get isKicked() { get isKicked() {
return this._kickDetails?.membership === "leave"; return this._kickDetails?.membership === "leave";
} }

View file

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

View file

@ -179,7 +179,6 @@ export class Invite extends EventEmitter {
_createData(inviteState, myInvite, inviter, summaryData, heroes) { _createData(inviteState, myInvite, inviter, summaryData, heroes) {
const name = heroes ? heroes.roomName : summaryData.name; const name = heroes ? heroes.roomName : summaryData.name;
const avatarUrl = heroes ? heroes.roomAvatarUrl : summaryData.avatarUrl; const avatarUrl = heroes ? heroes.roomAvatarUrl : summaryData.avatarUrl;
const avatarColorId = heroes ? heroes.roomAvatarColorId : summaryData.avatarColorId;
return { return {
roomId: this.id, roomId: this.id,
isEncrypted: !!summaryData.encryption, isEncrypted: !!summaryData.encryption,
@ -187,7 +186,7 @@ export class Invite extends EventEmitter {
// type: // type:
name, name,
avatarUrl, avatarUrl,
avatarColorId, avatarColorId: summaryData.avatarColorId,
canonicalAlias: summaryData.canonicalAlias, canonicalAlias: summaryData.canonicalAlias,
timestamp: this._platform.clock.now(), timestamp: this._platform.clock.now(),
joinRule: this._getJoinRule(inviteState), joinRule: this._getJoinRule(inviteState),

View file

@ -97,13 +97,4 @@ export class Heroes {
} }
return null; return null;
} }
get roomAvatarColorId() {
if (this._members.size === 1) {
for (const member of this._members.values()) {
return member.userId;
}
}
return null;
}
} }