REFACTOR: Add `themeSettings` to the `helperContext` to avoid a global

REFACTOR: Add themeSettings to the helperContext to avoid a global

diff --git a/app/assets/javascripts/discourse-common/addon/lib/helpers.js b/app/assets/javascripts/discourse-common/addon/lib/helpers.js
index 826a585..efdfdd5 100644
--- a/app/assets/javascripts/discourse-common/addon/lib/helpers.js
+++ b/app/assets/javascripts/discourse-common/addon/lib/helpers.js
@@ -46,10 +46,8 @@ export function registerHelpers(registry) {
 }
 
 let _helperContext;
-export function createHelperContext(siteSettings) {
-  _helperContext = {
-    siteSettings
-  };
+export function createHelperContext(ctx) {
+  _helperContext = ctx;
 }
 
 // This can be used by a helper to get the SiteSettings. Note you should not
diff --git a/app/assets/javascripts/discourse/app/helpers/theme-helpers.js b/app/assets/javascripts/discourse/app/helpers/theme-helpers.js
index 1e87865..354d69d 100644
--- a/app/assets/javascripts/discourse/app/helpers/theme-helpers.js
+++ b/app/assets/javascripts/discourse/app/helpers/theme-helpers.js
@@ -1,5 +1,5 @@
 import I18n from "I18n";
-import { registerUnbound } from "discourse-common/lib/helpers";
+import { helperContext, registerUnbound } from "discourse-common/lib/helpers";
 import deprecated from "discourse-common/lib/deprecated";
 
 registerUnbound("theme-i18n", (themeId, key, params) => {
@@ -18,7 +18,5 @@ registerUnbound("theme-setting", (themeId, key, hash) => {
       { since: "v2.2.0.beta8", dropFrom: "v2.3.0" }
     );
   }
-  return Discourse.__container__
-    .lookup("service:theme-settings")
-    .getSetting(themeId, key);
+  return helperContext().themeSettings.getSetting(themeId, key);
 });
diff --git a/app/assets/javascripts/discourse/app/initializers/auto-load-modules.js b/app/assets/javascripts/discourse/app/initializers/auto-load-modules.js
index e68c919..b1b3873 100644
--- a/app/assets/javascripts/discourse/app/initializers/auto-load-modules.js
+++ b/app/assets/javascripts/discourse/app/initializers/auto-load-modules.js
@@ -16,7 +16,8 @@ export function autoLoadModules(container, registry) {
     }
   });
   let siteSettings = container.lookup("site-settings:main");
-  createHelperContext(siteSettings);
+  let themeSettings = container.lookup("service:theme-settings");
+  createHelperContext({ siteSettings, themeSettings });
   registerHelpers(registry);
   registerRawHelpers(RawHandlebars, Handlebars);
 }
diff --git a/test/javascripts/test_helper.js b/test/javascripts/test_helper.js
index 17e3218..95f2f6f 100644
--- a/test/javascripts/test_helper.js
+++ b/test/javascripts/test_helper.js
@@ -164,7 +164,7 @@ QUnit.testStart(function(ctx) {
   Session.resetCurrent();
   User.resetCurrent();
   resetSite(settings);
-  createHelperContext(settings);
+  createHelperContext({ siteSettings: settings });
 
   _DiscourseURL.redirectedTo = null;
   _DiscourseURL.redirectTo = function(url) {

GitHub sha: 41fd7a8b