From 2c6e9349ebd87c775fd58e63582015ab3bbbe595 Mon Sep 17 00:00:00 2001
From: Roxanne Skelly <roxanne@highfidelity.io>
Date: Wed, 26 Sep 2018 12:59:15 -0700
Subject: [PATCH] SysTray Setup.  server-console.exe should be included in
 client-only installs.

By default, on new install, tray notifier should be enabled.
---
 server-console/CMakeLists.txt                  | 12 ++++++++++--
 server-console/src/main.js                     | 16 +++++++---------
 server-console/src/modules/hf-notifications.js |  4 ++--
 3 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/server-console/CMakeLists.txt b/server-console/CMakeLists.txt
index bdcefda5d8..16189dff9d 100644
--- a/server-console/CMakeLists.txt
+++ b/server-console/CMakeLists.txt
@@ -36,7 +36,11 @@ if (APPLE)
     PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGED_CONSOLE_FOLDER}"
     DESTINATION ${CONSOLE_INSTALL_DIR}
     COMPONENT ${SERVER_COMPONENT}
-	COMPONENT ${CLIENT_COMPONENT}
+  )
+  install(
+    PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGED_CONSOLE_FOLDER}"
+    DESTINATION ${CONSOLE_INSTALL_DIR}
+    COMPONENT ${CLIENT_COMPONENT}
   )
 elseif (WIN32)
   set(CONSOLE_DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGED_CONSOLE_FOLDER}")
@@ -45,7 +49,11 @@ elseif (WIN32)
     DIRECTORY "${CONSOLE_DESTINATION}/"
     DESTINATION ${CONSOLE_INSTALL_DIR}
     COMPONENT ${SERVER_COMPONENT}
-	COMPONENT ${CLIENT_COMPONENT}
+  )
+  install(
+    DIRECTORY "${CONSOLE_DESTINATION}/"
+    DESTINATION ${CONSOLE_INSTALL_DIR}
+    COMPONENT ${CLIENT_COMPONENT}
   )
 
   # sign the copied server console executable after install
diff --git a/server-console/src/main.js b/server-console/src/main.js
index 08692fbd50..cfde72e3bc 100644
--- a/server-console/src/main.js
+++ b/server-console/src/main.js
@@ -509,11 +509,13 @@ function buildMenuArray(serverState) {
         menuArray.push(labels.share);
         menuArray.push(separator);
         if (isInterfaceInstalled()) {
-            menuArray.push(labels.goto);
-            menuArray.push(labels.people);
-            menuArray.push(labels.wallet);
-            menuArray.push(labels.marketplace);
-            menuArray.push(separator);
+            if(trayNotifications.enabled()) {
+                menuArray.push(labels.goto);
+                menuArray.push(labels.people);
+                menuArray.push(labels.wallet);
+                menuArray.push(labels.marketplace);
+                menuArray.push(separator);
+            }
             menuArray.push(labels.showNotifications);
             menuArray.push(separator);
         }
@@ -545,10 +547,6 @@ function updateLabels(serverState) {
     }
 
     labels.showNotifications.checked = trayNotifications.enabled();
-    labels.people.visible = trayNotifications.enabled();
-    labels.goto.visible = trayNotifications.enabled();
-    labels.wallet.visible = trayNotifications.enabled();
-    labels.marketplace.visible = trayNotifications.enabled();
     labels.goto.icon = pendingNotifications[HifiNotificationType.GOTO] ? menuNotificationIcon : null;
     labels.people.icon = pendingNotifications[HifiNotificationType.PEOPLE] ? menuNotificationIcon : null;
     labels.wallet.icon = pendingNotifications[HifiNotificationType.WALLET] ? menuNotificationIcon : null;
diff --git a/server-console/src/modules/hf-notifications.js b/server-console/src/modules/hf-notifications.js
index a9ee2489a9..a95a553631 100644
--- a/server-console/src/modules/hf-notifications.js
+++ b/server-console/src/modules/hf-notifications.js
@@ -139,7 +139,7 @@ function HifiNotifications(config, menuNotificationCallback) {
 
 HifiNotifications.prototype = {
     enable: function (enabled) {
-        this.config.set("enableTrayNotifications", enabled);
+        this.config.set("disableTrayNotifications", !enabled);
         if (enabled) {
             var _this = this;
             this.storiesPollTimer = setInterval(function () {
@@ -185,7 +185,7 @@ HifiNotifications.prototype = {
         }
     },
     enabled: function () {
-        return this.config.get("enableTrayNotifications", true);
+        return !this.config.get("disableTrayNotifications", false);
     },
     stopPolling: function () {
         this.config.set("storiesNotifySince", this.storiesSince.toISOString());