diff --git a/client/coral-framework/helpers/plugins.js b/client/coral-framework/helpers/plugins.js index d93bb30f9..2e5934bc4 100644 --- a/client/coral-framework/helpers/plugins.js +++ b/client/coral-framework/helpers/plugins.js @@ -10,17 +10,17 @@ import {loadTranslations} from 'coral-framework/services/i18n'; import {injectReducers, getStore} from 'coral-framework/services/store'; import camelize from './camelize'; -export function getSlotComponents(slot) { +function getSlotComponents(slot) { const pluginConfig = getStore().getState().config.plugin_config; + // Filter out components that have been disabled in `plugin_config` return flatten(plugins - + // Filter out components that have slots and have been disabled in `plugin_config` - .filter((o) => o.module.slots && (!pluginConfig || !pluginConfig[o.name] || !pluginConfig[o.name].disable_components)) + .filter((o) => o.module.slots && (!pluginConfig || !pluginConfig[o.plugin] || !pluginConfig[o.plugin].disable_components)) .filter((o) => o.module.slots[slot]) - .map((o) => o.module.slots[slot]) - ); + .map((o) => o.module.slots[slot])); } export function isSlotEmpty(slot) { @@ -113,22 +113,7 @@ export function injectPluginsReducers() { const reducers = merge( ...plugins .filter((o) => o.module.reducer) - .map((o) => ({[camelize(o.name)] : o.module.reducer})) + .map((o) => ({[camelize(o.plugin)] : o.module.reducer})) ); injectReducers(reducers); } - -function addMetaDataToSlotComponents() { - - // Add talkPluginName to Slot Components. - plugins.forEach((plugin) => { - const slots = plugin.module.slots; - slots && Object.keys(slots).forEach((slot) => { - slots[slot].forEach((component) => { - component.talkPluginName = plugin.name; - }); - }); - }); -} - -addMetaDataToSlotComponents(); diff --git a/package.json b/package.json index 21e597c4b..71a07f4da 100644 --- a/package.json +++ b/package.json @@ -79,6 +79,7 @@ "express-session": "^1.15.1", "file-loader": "^0.11.2", "form-data": "^2.1.2", + "fs-extra": "^3.0.1", "gql-merge": "^0.0.4", "graphql": "^0.9.1", "graphql-errors": "^2.1.0",