FIX: notifications not updating correctly from background tab

We refactored some code to avoid app event leak in tests at c462c2f2

Unfortunately this broke all background notifications in title and they
were broken for the past multiple months.
This commit is contained in:
Sam Saffron 2019-08-30 15:51:20 +10:00
parent e9cf0de588
commit 3e855e33ae
1 changed files with 8 additions and 3 deletions

View File

@ -6,8 +6,7 @@ export default {
const user = container.lookup("current-user:main");
if (!user) return; // must be logged in
this.notifications =
user.unread_notifications + user.unread_private_messages;
this.container = container;
container
.lookup("app-events:main")
@ -15,6 +14,12 @@ export default {
},
_updateTitle() {
Discourse.updateNotificationCount(this.notifications);
const user = this.container.lookup("current-user:main");
if (!user) return; // must be logged in
const notifications =
user.unread_notifications + user.unread_private_messages;
Discourse.updateNotificationCount(notifications);
}
};