diff --git a/app/assets/javascripts/discourse/controllers/site-map.js.es6 b/app/assets/javascripts/discourse/controllers/site-map.js.es6 index 7ba7d1273c1..fd880d0a120 100644 --- a/app/assets/javascripts/discourse/controllers/site-map.js.es6 +++ b/app/assets/javascripts/discourse/controllers/site-map.js.es6 @@ -10,11 +10,11 @@ export default Ember.ArrayController.extend(Discourse.HasCurrentUser, { badgesUrl: Discourse.getURL('/badges'), showKeyboardShortcuts: function(){ - return !Discourse.Mobile.mobileView && !Discourse.Capabilities.touch; + return !Discourse.Mobile.mobileView && !this.capabilities.touch; }.property(), showMobileToggle: function(){ - return Discourse.Mobile.mobileView || (Discourse.SiteSettings.enable_mobile_theme && Discourse.Capabilities.touch); + return Discourse.Mobile.mobileView || (Discourse.SiteSettings.enable_mobile_theme && this.capabilities.touch); }.property(), mobileViewLinkTextKey: function() { diff --git a/app/assets/javascripts/discourse/initializers/sniff-capabilities.js.es6 b/app/assets/javascripts/discourse/initializers/sniff-capabilities.js.es6 index 46ace48ace3..90a722de9a0 100644 --- a/app/assets/javascripts/discourse/initializers/sniff-capabilities.js.es6 +++ b/app/assets/javascripts/discourse/initializers/sniff-capabilities.js.es6 @@ -1,8 +1,7 @@ /*global Modernizr:true*/ /** - Initializes the `Discourse.Capabilities` singleton by sniffing out the browser - capabilities. + Initializes an object that lets us know about our capabilities. **/ export default { name: "sniff-capabilities", @@ -28,7 +27,6 @@ export default { // Inject it application.register('capabilities:main', caps, { instantiate: false }); application.inject('view', 'capabilities', 'capabilities:main'); - - Discourse.Capabilities = caps; + application.inject('controller', 'capabilities', 'capabilities:main'); } }; diff --git a/test/javascripts/controllers/site-map-test.js.es6 b/test/javascripts/controllers/site-map-test.js.es6 index 5baf83c9484..7e3c017dcda 100644 --- a/test/javascripts/controllers/site-map-test.js.es6 +++ b/test/javascripts/controllers/site-map-test.js.es6 @@ -50,6 +50,7 @@ test("showMoblieToggle returns true when mobile theme is enabled in site setting Discourse.SiteSettings.enable_mobile_theme = true; Discourse.Mobile.isMobileDevice = true; var controller = this.subject(); + controller.capabilities = { touch: true }; equal(controller.get("showMobileToggle"), true); });