summaryrefslogtreecommitdiffstats
path: root/webapp/components/post_view/reaction_list/index.js
blob: ee807ca881e0711f5b8033a623c9c7406857227a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.

import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import {makeGetReactionsForPost} from 'mattermost-redux/selectors/entities/posts';
import {getCustomEmojisByName} from 'mattermost-redux/selectors/entities/emojis';

import * as Actions from 'mattermost-redux/actions/posts';

import ReactionList from './reaction_list.jsx';

function makeMapStateToProps() {
    const getReactionsForPost = makeGetReactionsForPost();

    return function mapStateToProps(state, ownProps) {
        return {
            ...ownProps,
            reactions: getReactionsForPost(state, ownProps.post.id),
            emojis: getCustomEmojisByName(state)
        };
    };
}

function mapDispatchToProps(dispatch) {
    return {
        actions: bindActionCreators({
            getReactionsForPost: Actions.getReactionsForPost
        }, dispatch)
    };
}

export default connect(makeMapStateToProps, mapDispatchToProps)(ReactionList);