Disable intercom for anonymous users

Disable intercom for anonymous users

diff --git a/assets/javascripts/discourse/initializers/intercom.js.es6 b/assets/javascripts/discourse/initializers/intercom.js.es6
index 9745db6..966b81a 100644
--- a/assets/javascripts/discourse/initializers/intercom.js.es6
+++ b/assets/javascripts/discourse/initializers/intercom.js.es6
@@ -4,11 +4,11 @@ export default {
 
   initialize(container) {
     const siteSettings = container.lookup("site-settings:main");
-    if (!siteSettings.intercom_enabled) {
+    const currentUser = Discourse.User.current();
+    if (!siteSettings.intercom_enabled || !currentUser) {
       return;
     }
 
-    const currentUser = Discourse.User.current();
     const startMessenger = () => { var w = window; var ic = w.Intercom; if (typeof ic === "function") { ic('reattach_activator'); ic('update', intercomSettings); } else { var d = document; var i = function () { i.c(arguments); }; i.q = []; i.c = function (args) { i.q.push(args); }; w.Intercom = i; function l() { var s = d.createElement('script'); s.type = 'text/javascript'; s.async = true; s.src = `https://widget.intercom.io/widget/${ siteSettings.intercom_app_id }`; var x = d.getElementsByTagName('script')[0]; x.parentNode.insertBefore(s, x); } l(); } };
 
     window.intercomSettings = {

GitHub sha: c81207a8e599d629f6cd9109496da1a0a4708f84