From d1fc5668fb1ee8818017409554d0cf8b15f20743 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Tue, 8 Aug 2017 19:50:59 +0700 Subject: [PATCH 1/2] Pass config to plugins --- client/coral-framework/helpers/plugins.js | 4 ++-- plugin-api/beta/client/hocs/withReaction.js | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/client/coral-framework/helpers/plugins.js b/client/coral-framework/helpers/plugins.js index 1af2a9a59..5e5a8c0c0 100644 --- a/client/coral-framework/helpers/plugins.js +++ b/client/coral-framework/helpers/plugins.js @@ -10,7 +10,7 @@ import camelize from './camelize'; import plugins from 'pluginsConfig'; export function getSlotComponents(slot, reduxState, props = {}) { - const pluginConfig = reduxState.config.pluginConfig || {}; + const pluginConfig = reduxState.config.plugin_config || {}; return flatten(plugins // Filter out components that have slots and have been disabled in `plugin_config` @@ -39,7 +39,7 @@ export function isSlotEmpty(slot, reduxState, props) { * Returns React Elements for given slot. */ export function getSlotElements(slot, reduxState, props = {}) { - const pluginConfig = reduxState.config.pluginConfig || {}; + const pluginConfig = reduxState.config.plugin_config || {}; return getSlotComponents(slot, reduxState, props) .map((component, i) => React.createElement(component, {key: i, ...props, config: pluginConfig})); } diff --git a/plugin-api/beta/client/hocs/withReaction.js b/plugin-api/beta/client/hocs/withReaction.js index 40ee6e14c..7f43cc5b2 100644 --- a/plugin-api/beta/client/hocs/withReaction.js +++ b/plugin-api/beta/client/hocs/withReaction.js @@ -271,6 +271,7 @@ export default (reaction) => (WrappedComponent) => { alreadyReacted={alreadyReacted} postReaction={this.postReaction} deleteReaction={this.deleteReaction} + config={this.props.config} />; } } From c4a91d225e57657cdf56d4861373413dea374348 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Tue, 8 Aug 2017 19:57:23 +0700 Subject: [PATCH 2/2] Pass config also to withTags --- plugin-api/beta/client/hocs/withTags.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugin-api/beta/client/hocs/withTags.js b/plugin-api/beta/client/hocs/withTags.js index 75d434bef..e9b5bdff0 100644 --- a/plugin-api/beta/client/hocs/withTags.js +++ b/plugin-api/beta/client/hocs/withTags.js @@ -68,16 +68,17 @@ export default (tag) => (WrappedComponent) => { } render() { - const {comment} = this.props; + const {comment, user, config} = this.props; const alreadyTagged = isTagged(comment.tags, TAG); return ; } }