mattermost-mobile/app/components/post/index.js
enahum dabad3eca6 Improving Performance Part 1 (#1009)
* Dispatch retry failed action | fix refreshing state | change postVisibility to 15

* Improve channel switching

* Improve handling of visible tooltip

* Improve watching for status bar height changes

* Remove unnecessary mapStateToProps from code screen

* Use drawer native functions to open/close instead of state

* Feedback review
2017-10-11 14:33:26 -03:00

46 lines
1.4 KiB
JavaScript

// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import {addReaction, createPost, deletePost, removePost} from 'mattermost-redux/actions/posts';
import {getPost} from 'mattermost-redux/selectors/entities/posts';
import {getCurrentUserId, getCurrentUserRoles} from 'mattermost-redux/selectors/entities/users';
import {getTheme} from 'app/selectors/preferences';
import Post from './post';
function makeMapStateToProps() {
return function mapStateToProps(state, ownProps) {
const post = getPost(state, ownProps.post.id);
const {config, license} = state.entities.general;
const roles = getCurrentUserId(state) ? getCurrentUserRoles(state) : '';
return {
...ownProps,
post,
config,
currentUserId: getCurrentUserId(state),
highlight: ownProps.post.highlight,
license,
roles,
theme: getTheme(state)
};
};
}
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators({
addReaction,
createPost,
deletePost,
removePost
}, dispatch)
};
}
export default connect(makeMapStateToProps, mapDispatchToProps)(Post);