blob: ed76184272bd671e2e83908c12d74f1e3285ebc2 (
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
34
35
36
37
|
// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import {getPost, makeGetPostsForThread} from 'mattermost-redux/selectors/entities/posts';
import {removePost} from 'mattermost-redux/actions/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
};
};
}
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators({
removePost
}, dispatch)
};
}
export default connect(makeMapStateToProps, mapDispatchToProps)(RhsThread);
|