diff options
Diffstat (limited to 'webapp/components/rhs_thread/index.js')
-rw-r--r-- | webapp/components/rhs_thread/index.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/webapp/components/rhs_thread/index.js b/webapp/components/rhs_thread/index.js new file mode 100644 index 000000000..c4465cafd --- /dev/null +++ b/webapp/components/rhs_thread/index.js @@ -0,0 +1,27 @@ +// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +import {connect} from 'react-redux'; +import {getPost, makeGetPostsForThread} from 'mattermost-redux/selectors/entities/posts'; + +import RhsThread from './rhs_thread.jsx'; + +function makeMapStateToProps() { + const getPostsForThread = makeGetPostsForThread(); + + return function mapStateToProps(state, ownProps) { + const selected = getPost(state, state.views.rhs.selectedPostId); + let posts = []; + if (selected) { + posts = getPostsForThread(state, {rootId: selected.id, channelId: selected.channel_id}); + } + + return { + ...ownProps, + selected, + posts + }; + }; +} + +export default connect(makeMapStateToProps)(RhsThread); |