Removed unused props from ChannelPostList (#1306)

This commit is contained in:
Harrison Healey 2017-12-21 07:09:16 -05:00 committed by enahum
parent 16e293ffab
commit 593dd9f033
2 changed files with 14 additions and 25 deletions

View file

@ -3,7 +3,6 @@
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {injectIntl, intlShape} from 'react-intl';
import {
Platform,
StyleSheet,
@ -15,7 +14,7 @@ import PostListRetry from 'app/components/post_list_retry';
import RetryBarIndicator from 'app/components/retry_bar_indicator';
import tracker from 'app/utils/time_tracker';
class ChannelPostList extends PureComponent {
export default class ChannelPostList extends PureComponent {
static propTypes = {
actions: PropTypes.shape({
loadPostsIfNecessaryWithRetry: PropTypes.func.isRequired,
@ -28,12 +27,10 @@ class ChannelPostList extends PureComponent {
channelId: PropTypes.string.isRequired,
channelRefreshingFailed: PropTypes.bool,
currentUserId: PropTypes.string,
intl: intlShape.isRequired,
lastViewedAt: PropTypes.number,
navigator: PropTypes.object,
postIds: PropTypes.array.isRequired,
postVisibility: PropTypes.number,
totalMessageCount: PropTypes.number,
theme: PropTypes.object.isRequired
};
@ -175,5 +172,3 @@ const style = StyleSheet.create({
flex: 1
}
});
export default injectIntl(ChannelPostList);

View file

@ -6,7 +6,7 @@ import {connect} from 'react-redux';
import {selectPost} from 'mattermost-redux/actions/posts';
import {getPostIdsInCurrentChannel} from 'mattermost-redux/selectors/entities/posts';
import {getCurrentChannelId, getMyCurrentChannelMembership, makeGetChannel} from 'mattermost-redux/selectors/entities/channels';
import {getCurrentChannelId, getMyCurrentChannelMembership} from 'mattermost-redux/selectors/entities/channels';
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
import {getTheme} from 'mattermost-redux/selectors/entities/preferences';
@ -15,24 +15,18 @@ import {recordLoadTime} from 'app/actions/views/root';
import ChannelPostList from './channel_post_list';
function makeMapStateToProps() {
const getChannel = makeGetChannel();
function mapStateToProps(state) {
const channelId = getCurrentChannelId(state);
const channelRefreshingFailed = state.views.channel.retryFailed;
return function mapStateToProps(state) {
const channelId = getCurrentChannelId(state);
const channelRefreshingFailed = state.views.channel.retryFailed;
const channel = getChannel(state, {id: channelId}) || {};
return {
channelId,
channelRefreshingFailed,
currentUserId: getCurrentUserId(state),
postIds: getPostIdsInCurrentChannel(state),
postVisibility: state.views.channel.postVisibility[channelId],
lastViewedAt: getMyCurrentChannelMembership(state).last_viewed_at,
totalMessageCount: channel.total_msg_count,
theme: getTheme(state)
};
return {
channelId,
channelRefreshingFailed,
currentUserId: getCurrentUserId(state),
postIds: getPostIdsInCurrentChannel(state),
postVisibility: state.views.channel.postVisibility[channelId],
lastViewedAt: getMyCurrentChannelMembership(state).last_viewed_at,
theme: getTheme(state)
};
}
@ -49,4 +43,4 @@ function mapDispatchToProps(dispatch) {
};
}
export default connect(makeMapStateToProps, mapDispatchToProps)(ChannelPostList);
export default connect(mapStateToProps, mapDispatchToProps)(ChannelPostList);