From 25daca8f23da3f40d5e6d5e42c36f31d5eceb166 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 4 Feb 2015 16:23:39 -0500 Subject: [PATCH] Helpers for plugins to support enabling/disabling --- .../discourse/helpers/plugin-outlet.js.es6 | 34 ++++++++---- app/controllers/application_controller.rb | 10 ++++ app/serializers/site_serializer.rb | 7 ++- lib/discourse.rb | 5 ++ lib/plugin/instance.rb | 39 ++++++++++++-- spec/components/plugin/instance_spec.rb | 54 +++++++++++++++++++ 6 files changed, 135 insertions(+), 14 deletions(-) diff --git a/app/assets/javascripts/discourse/helpers/plugin-outlet.js.es6 b/app/assets/javascripts/discourse/helpers/plugin-outlet.js.es6 index 42802f8bcee..a209513aefd 100644 --- a/app/assets/javascripts/discourse/helpers/plugin-outlet.js.es6 +++ b/app/assets/javascripts/discourse/helpers/plugin-outlet.js.es6 @@ -39,18 +39,35 @@ Nobody says hello :'( {{/plugin-outlet}} ``` + + ## Disabling + + If a plugin returns a disabled status, the outlets will not be wired up for it. + The list of disabled plugins is returned via the `Site` singleton. + **/ var _connectorCache; function findOutlets(collection, callback) { - Ember.keys(collection).forEach(function(i) { - if (i.indexOf("/connectors/") !== -1) { - var segments = i.split("/"), + + var disabledPlugins = Discourse.Site.currentProp('disabled_plugins') || []; + + Ember.keys(collection).forEach(function(res) { + if (res.indexOf("/connectors/") !== -1) { + // Skip any disabled plugins + for (var i=0; i