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() {
|
get avatarColorNumber() {
|
||||||
return getIdentifierColorNumber(this._invite.id)
|
return getIdentifierColorNumber(this._invite.avatarColorId)
|
||||||
}
|
}
|
||||||
|
|
||||||
avatarUrl(size) {
|
avatarUrl(size) {
|
||||||
|
|
|
@ -107,6 +107,10 @@ 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";
|
||||||
}
|
}
|
||||||
|
|
|
@ -341,6 +341,10 @@ export class BaseRoom extends EventEmitter {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get avatarColorId() {
|
||||||
|
return this._heroes?.roomAvatarColorId || this._roomId
|
||||||
|
}
|
||||||
|
|
||||||
get lastMessageTimestamp() {
|
get lastMessageTimestamp() {
|
||||||
return this._summary.data.lastMessageTimestamp;
|
return this._summary.data.lastMessageTimestamp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,10 @@ export class Invite extends EventEmitter {
|
||||||
return this._inviteData.avatarUrl;
|
return this._inviteData.avatarUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get avatarColorId() {
|
||||||
|
return this._inviteData.avatarColorId;
|
||||||
|
}
|
||||||
|
|
||||||
get timestamp() {
|
get timestamp() {
|
||||||
return this._inviteData.timestamp;
|
return this._inviteData.timestamp;
|
||||||
}
|
}
|
||||||
|
@ -175,6 +179,7 @@ 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,
|
||||||
|
@ -182,6 +187,7 @@ export class Invite extends EventEmitter {
|
||||||
// type:
|
// type:
|
||||||
name,
|
name,
|
||||||
avatarUrl,
|
avatarUrl,
|
||||||
|
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),
|
||||||
|
|
|
@ -328,10 +328,6 @@ export class Room extends BaseRoom {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
get avatarColorId() {
|
|
||||||
return this._heroes?.roomAvatarColorId || this._roomId
|
|
||||||
}
|
|
||||||
|
|
||||||
get isUnread() {
|
get isUnread() {
|
||||||
return this._summary.data.isUnread;
|
return this._summary.data.isUnread;
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,6 +239,15 @@ export class SummaryData {
|
||||||
return !this.name && !this.canonicalAlias && this.heroes && this.heroes.length > 0;
|
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) {
|
isNewJoin(oldData) {
|
||||||
return this.membership === "join" && oldData.membership !== "join";
|
return this.membership === "join" && oldData.membership !== "join";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue