This commit is contained in:
Michael Telatynski 2021-09-10 11:09:46 +01:00
parent aff9be6120
commit 9a8a453827
2 changed files with 8 additions and 8 deletions

View file

@ -31,6 +31,10 @@ export class ListNotificationState extends NotificationState {
super();
}
public get symbol(): string {
return this._color === NotificationColor.Unsent ? "!" : null;
}
public setRooms(rooms: Room[]) {
// If we're only concerned about the tile count, don't bother setting up listeners.
if (this.byTileCount) {
@ -78,7 +82,6 @@ export class ListNotificationState extends NotificationState {
private calculateTotalState() {
const snapshot = this.snapshot();
this._symbol = null;
if (this.byTileCount) {
this._color = NotificationColor.Red;
this._count = this.rooms.length;
@ -89,10 +92,6 @@ export class ListNotificationState extends NotificationState {
this._count += state.count;
this._color = Math.max(this.color, state.color);
}
if (this._color === NotificationColor.Unsent) {
this._symbol = "!";
}
}
// finally, publish an update if needed

View file

@ -30,6 +30,10 @@ export class SpaceNotificationState extends NotificationState {
super();
}
public get symbol(): string {
return this._color === NotificationColor.Unsent ? "!" : null;
}
public setRooms(rooms: Room[]) {
const oldRooms = this.rooms;
const diff = arrayDiff(oldRooms, rooms);
@ -75,10 +79,7 @@ export class SpaceNotificationState extends NotificationState {
this._color = Math.max(this.color, state.color);
}
this._symbol = this._color === NotificationColor.Unsent ? "!" : null;
// finally, publish an update if needed
this.emitIfUpdated(snapshot);
}
}