diff --git a/server-console/src/main.js b/server-console/src/main.js index 5c77c26270..bea6504deb 100644 --- a/server-console/src/main.js +++ b/server-console/src/main.js @@ -338,13 +338,15 @@ const HifiNotificationType = hfNotifications.NotificationType; var pendingNotifications = {} var notificationState = NotificationState.UNNOTIFIED; -function setNotificationState (notificationType, pending = true) { - pendingNotifications[notificationType] = pending; - notificationState = NotificationState.UNNOTIFIED; - for (var key in pendingNotifications) { - if (pendingNotifications[key]) { - notificationState = NotificationState.NOTIFIED; - break; +function setNotificationState (notificationType, pending = undefined) { + if (pending !== undefined) { + pendingNotifications[notificationType] = pending; + notificationState = NotificationState.UNNOTIFIED; + for (var key in pendingNotifications) { + if (pendingNotifications[key]) { + notificationState = NotificationState.NOTIFIED; + break; + } } } updateTrayMenu(homeServer ? homeServer.state : ProcessGroupStates.STOPPED); @@ -569,9 +571,12 @@ function updateLabels(serverState) { labels.wallet.icon = pendingNotifications[HifiNotificationType.WALLET] ? menuNotificationIcon : null; labels.marketplace.icon = pendingNotifications[HifiNotificationType.MARKETPLACE] ? menuNotificationIcon : null; var onlineUsers = trayNotifications.getOnlineUsers(); + delete labels.people.submenu; if (onlineUsers) { - labels.people.submenu = []; for (var name in onlineUsers) { + if(labels.people.submenu == undefined) { + labels.people.submenu = []; + } labels.people.submenu.push({ label: name, enabled: (onlineUsers[name].location != undefined), @@ -585,14 +590,17 @@ function updateLabels(serverState) { } } var currentStories = trayNotifications.getCurrentStories(); - if (currentStories && currentStories.length) { - labels.goto.submenu = []; + delete labels.goto.submenu; + if (currentStories) { for (var location in currentStories) { + if(labels.goto.submenu == undefined) { + labels.goto.submenu = []; + } labels.goto.submenu.push({ label: "event in " + location, click: function () { setNotificationState(HifiNotificationType.GOTO, false); - StartInterface("hifi://" + location + getCurrentStories[location].path); + StartInterface("hifi://" + location + currentStories[location].path); } }); } diff --git a/server-console/src/modules/hf-notifications.js b/server-console/src/modules/hf-notifications.js index 2b287ba392..b1f337bbc3 100644 --- a/server-console/src/modules/hf-notifications.js +++ b/server-console/src/modules/hf-notifications.js @@ -302,7 +302,6 @@ HifiNotifications.prototype = { finished(false); return; } - console.log(content); if (!content.total_entries) { finished(true, token); return; @@ -326,7 +325,6 @@ HifiNotifications.prototype = { notifyData = content.data.updates; break; } - notifyData.forEach(function (notifyDataEntry) { _this._addNotification(new HifiNotification(notifyType, notifyDataEntry)); }); @@ -381,13 +379,13 @@ HifiNotifications.prototype = { finished(false); return; } - console.log(content); + if (!content.total_entries) { finished(true, token); return; } if (!content.total_entries) { - this.menuNotificationCallback(NotificationType.GOTO, false); + _this.menuNotificationCallback(NotificationType.GOTO, false); } _this.currentStories = {}; content.user_stories.forEach(function (story) { @@ -397,6 +395,7 @@ HifiNotifications.prototype = { // for each story. _this.currentStories[story.place_name] = story; }); + _this.menuNotificationCallback(NotificationType.GOTO); }); } });