From 774518e4fe336ac60c6e8ccdbc9a98e0cb8b9310 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Tue, 11 Feb 2020 10:14:09 -0500 Subject: Fixing unread indicator on link click. Fixes #527 --- ui/src/components/navbar.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'ui/src/components/navbar.tsx') diff --git a/ui/src/components/navbar.tsx b/ui/src/components/navbar.tsx index c675cfe7..75cdd554 100644 --- a/ui/src/components/navbar.tsx +++ b/ui/src/components/navbar.tsx @@ -60,8 +60,10 @@ export class Navbar extends Component { // Subscribe to user changes this.userSub = UserService.Instance.sub.subscribe(user => { this.state.isLoggedIn = user.user !== undefined; - this.state.unreadCount = user.unreadCount; - this.requestNotificationPermission(); + if (this.state.isLoggedIn) { + this.state.unreadCount = user.user.unreadCount; + this.requestNotificationPermission(); + } this.setState(this.state); }); @@ -304,9 +306,9 @@ export class Navbar extends Component { } sendUnreadCount() { + UserService.Instance.user.unreadCount = this.state.unreadCount; UserService.Instance.sub.next({ user: UserService.Instance.user, - unreadCount: this.state.unreadCount, }); } -- cgit v1.2.3