From 9a8a45382744f26ed42e43873464ee4e0805e8b1 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 10 Sep 2021 11:09:46 +0100 Subject: [PATCH] tidy --- src/stores/notifications/ListNotificationState.ts | 9 ++++----- src/stores/notifications/SpaceNotificationState.ts | 7 ++++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/stores/notifications/ListNotificationState.ts b/src/stores/notifications/ListNotificationState.ts index 4168fe80b6..97ba2bd80b 100644 --- a/src/stores/notifications/ListNotificationState.ts +++ b/src/stores/notifications/ListNotificationState.ts @@ -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 diff --git a/src/stores/notifications/SpaceNotificationState.ts b/src/stores/notifications/SpaceNotificationState.ts index c414a01fc2..137b2ca0f2 100644 --- a/src/stores/notifications/SpaceNotificationState.ts +++ b/src/stores/notifications/SpaceNotificationState.ts @@ -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); } } -