forked from mystiq/hydrogen-web
Correctly color archived and invited rooms
This commit is contained in:
parent
6527a0c677
commit
dec0683145
6 changed files with 24 additions and 5 deletions
|
@ -56,7 +56,7 @@ export class InviteViewModel extends ViewModel {
|
|||
}
|
||||
|
||||
get avatarColorNumber() {
|
||||
return getIdentifierColorNumber(this._invite.id)
|
||||
return getIdentifierColorNumber(this._invite.avatarColorId)
|
||||
}
|
||||
|
||||
avatarUrl(size) {
|
||||
|
|
|
@ -107,6 +107,10 @@ export class ArchivedRoom extends BaseRoom {
|
|||
this._emitUpdate();
|
||||
}
|
||||
|
||||
get avatarColorId() {
|
||||
return this._summary.data.avatarColorId;
|
||||
}
|
||||
|
||||
get isKicked() {
|
||||
return this._kickDetails?.membership === "leave";
|
||||
}
|
||||
|
|
|
@ -341,6 +341,10 @@ export class BaseRoom extends EventEmitter {
|
|||
return null;
|
||||
}
|
||||
|
||||
get avatarColorId() {
|
||||
return this._heroes?.roomAvatarColorId || this._roomId
|
||||
}
|
||||
|
||||
get lastMessageTimestamp() {
|
||||
return this._summary.data.lastMessageTimestamp;
|
||||
}
|
||||
|
|
|
@ -56,6 +56,10 @@ export class Invite extends EventEmitter {
|
|||
return this._inviteData.avatarUrl;
|
||||
}
|
||||
|
||||
get avatarColorId() {
|
||||
return this._inviteData.avatarColorId;
|
||||
}
|
||||
|
||||
get timestamp() {
|
||||
return this._inviteData.timestamp;
|
||||
}
|
||||
|
@ -175,6 +179,7 @@ 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,
|
||||
|
@ -182,6 +187,7 @@ export class Invite extends EventEmitter {
|
|||
// type:
|
||||
name,
|
||||
avatarUrl,
|
||||
avatarColorId,
|
||||
canonicalAlias: summaryData.canonicalAlias,
|
||||
timestamp: this._platform.clock.now(),
|
||||
joinRule: this._getJoinRule(inviteState),
|
||||
|
|
|
@ -328,10 +328,6 @@ export class Room extends BaseRoom {
|
|||
});
|
||||
}
|
||||
|
||||
get avatarColorId() {
|
||||
return this._heroes?.roomAvatarColorId || this._roomId
|
||||
}
|
||||
|
||||
get isUnread() {
|
||||
return this._summary.data.isUnread;
|
||||
}
|
||||
|
|
|
@ -239,6 +239,15 @@ export class SummaryData {
|
|||
return !this.name && !this.canonicalAlias && this.heroes && this.heroes.length > 0;
|
||||
}
|
||||
|
||||
get avatarColorId() {
|
||||
if (this.heroes && this.heroes.length === 1) {
|
||||
for (const hero of this.heroes) {
|
||||
return hero;
|
||||
}
|
||||
}
|
||||
return this.roomId;
|
||||
}
|
||||
|
||||
isNewJoin(oldData) {
|
||||
return this.membership === "join" && oldData.membership !== "join";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue