From cd08987502d4851e704e1f368c539250517cb1e2 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Thu, 30 Mar 2017 19:17:22 -0300 Subject: [PATCH] postRespect --- client/coral-embed-stream/src/Comment.js | 2 -- client/coral-embed-stream/src/Embed.js | 4 ++-- client/coral-framework/helpers/plugins.js | 4 ++++ plugins/coral-plugin-respect/client/index.js | 11 ++++++----- plugins/coral-plugin-respect/index.js | 12 ++++++++++++ 5 files changed, 24 insertions(+), 9 deletions(-) diff --git a/client/coral-embed-stream/src/Comment.js b/client/coral-embed-stream/src/Comment.js index 622d48b90..4f7827d3d 100644 --- a/client/coral-embed-stream/src/Comment.js +++ b/client/coral-embed-stream/src/Comment.js @@ -148,8 +148,6 @@ class Comment extends React.Component { ...rest }; - console.log('Commnet --------', pluginProps) - return (
- {/**/} + {/* */} {lang.t('MY_COMMENTS')} @@ -282,7 +282,7 @@ const mapStateToProps = (state) => Object userData: state.user.toJS(), asset: state.asset.toJS(), state: {} -}); + }); const mapDispatchToProps = dispatch => ({ requestConfirmEmail: () => dispatch(requestConfirmEmail()), diff --git a/client/coral-framework/helpers/plugins.js b/client/coral-framework/helpers/plugins.js index 7a0f2e2f3..af9079e6d 100644 --- a/client/coral-framework/helpers/plugins.js +++ b/client/coral-framework/helpers/plugins.js @@ -67,6 +67,10 @@ function injectPlugins ({fill, ...props}) { .map(addProps) .filter(filterBySlot) .reduce((entry, plugin, i) => { + // const element = React.cloneElement( + // context(plugin.key), + // {...plugin.props, key: i} + // ); entry = [...entry, context(plugin.key)({...plugin.props, key: i})]; return entry; }, []); diff --git a/plugins/coral-plugin-respect/client/index.js b/plugins/coral-plugin-respect/client/index.js index 234a3178d..df729f096 100644 --- a/plugins/coral-plugin-respect/client/index.js +++ b/plugins/coral-plugin-respect/client/index.js @@ -4,11 +4,12 @@ import {Icon} from 'coral-ui'; export default (props) => { const handleClick = () => { - props.actions.clickButton(); - // props.postRespect({ - // item_id: props.comment.id, - // item_type: 'COMMENTS' - // }); + // props.actions.clic kButton(); + + props.context.postRespect({ + item_id: props.context.comment.id, + item_type: 'COMMENTS' + }); }; const {clicked} = props.state.respect; diff --git a/plugins/coral-plugin-respect/index.js b/plugins/coral-plugin-respect/index.js index 915d14ac0..a1f9a0c1c 100644 --- a/plugins/coral-plugin-respect/index.js +++ b/plugins/coral-plugin-respect/index.js @@ -8,5 +8,17 @@ module.exports = { return Action.create({item_id, item_type, action_type: 'RESPECT'}); } } + }, + hooks: { + ActionSummary: { + __resolveType: { + post({action_type}) { + switch (action_type) { + case 'RESPECT': + return 'HappyActionSummary'; + } + } + } + } } };