From 47a235e06aecaefb41ae8929cc1d374d4e2cef06 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Fri, 25 Nov 2016 16:13:56 -0500 Subject: [PATCH] FIX: Raw plugin outlets were not working properly --- .../discourse/helpers/plugin-outlet.js.es6 | 36 ++++++------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/app/assets/javascripts/discourse/helpers/plugin-outlet.js.es6 b/app/assets/javascripts/discourse/helpers/plugin-outlet.js.es6 index 3f00baed783..32fd7d8bae9 100644 --- a/app/assets/javascripts/discourse/helpers/plugin-outlet.js.es6 +++ b/app/assets/javascripts/discourse/helpers/plugin-outlet.js.es6 @@ -29,7 +29,7 @@ The list of disabled plugins is returned via the `Site` singleton. **/ -let _connectorCache, _rawCache, _templateCache; +let _connectorCache, _templateCache; function findOutlets(collection, callback) { const disabledPlugins = Discourse.Site.currentProp('disabled_plugins') || []; @@ -55,29 +55,20 @@ function findOutlets(collection, callback) { export function clearCache() { _templateCache = null; _connectorCache = null; - _rawCache = null; } function buildConnectorCache() { _connectorCache = {}; - _rawCache = {}; _templateCache = []; findOutlets(Ember.TEMPLATES, function(outletName, resource, uniqueName) { - if (/\.raw$/.test(uniqueName)) { - if (!_rawCache[outletName]) { - _rawCache[outletName] = []; - } - _rawCache[outletName].push(Ember.TEMPLATES[resource]); - } else { - _connectorCache[outletName] = _connectorCache[outletName] || []; + _connectorCache[outletName] = _connectorCache[outletName] || []; - _connectorCache[outletName].push({ - templateName: resource.replace('javascripts/', ''), - template: Ember.TEMPLATES[resource], - classNames: `${outletName}-outlet ${uniqueName}` - }); - } + _connectorCache[outletName].push({ + templateName: resource.replace('javascripts/', ''), + template: Ember.TEMPLATES[resource], + classNames: `${outletName}-outlet ${uniqueName}` + }); }); Object.keys(_connectorCache).forEach(outletName => { @@ -91,16 +82,11 @@ function buildConnectorCache() { // unbound version of outlets, only has a template Handlebars.registerHelper('plugin-outlet', function(name) { - if (!_rawCache) { buildConnectorCache(); } - - const functions = _rawCache[name]; - if (functions) { - var output = []; - - for(var i=0; i c.template({context: this})); return new Handlebars.SafeString(output.join("")); } });