mattermost-mobile/app/components/post/post_container.js
Chris Duarte b09dbbb79c PLT-5493 Add a profile scene that shows user information (#287)
* PLT-5493 React Native: Add a profile scene that shows user information

* Review feedback
2017-02-24 10:17:05 -03:00

37 lines
1.2 KiB
JavaScript

// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import {getMyPreferences, getTheme} from 'service/selectors/entities/preferences';
import {goToUserProfile} from 'app/actions/navigation';
import {getUser} from 'service/selectors/entities/users';
import {displayUsername} from 'service/utils/user_utils';
import Post from './post';
function mapStateToProps(state, ownProps) {
const user = getUser(state, ownProps.post.user_id);
const commentedOnUser = ownProps.commentedOnPost ? getUser(state, ownProps.commentedOnPost.user_id) : null;
const myPreferences = getMyPreferences(state);
return {
user,
displayName: displayUsername(user, myPreferences),
commentedOnDisplayName: displayUsername(commentedOnUser, myPreferences),
theme: getTheme(state),
...ownProps
};
}
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators({
goToUserProfile
}, dispatch)
};
}
export default connect(mapStateToProps, mapDispatchToProps)(Post);