mattermost-mobile/app/screens/channel_members/index.js
Sudheer f02e0fc4f5
MM-13432 Remove unsed request flags from channel_members (#2490)
* Remove unsed request flags from channel_members

* Fix intial state to match redux state

* Update redux hash
2019-01-04 18:52:00 +05:30

45 lines
1.5 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import {handleRemoveChannelMembers} from 'app/actions/views/channel_members';
import {getTheme} from 'mattermost-redux/selectors/entities/preferences';
import {getCurrentChannelId, canManageChannelMembers} from 'mattermost-redux/selectors/entities/channels';
import {makeGetProfilesInChannel} from 'mattermost-redux/selectors/entities/users';
import {getProfilesInChannel, searchProfiles} from 'mattermost-redux/actions/users';
import ChannelMembers from './channel_members';
function makeMapStateToProps() {
const getChannelMembers = makeGetProfilesInChannel();
return (state) => {
const currentChannelId = getCurrentChannelId(state);
let currentChannelMembers = [];
if (currentChannelId) {
currentChannelMembers = getChannelMembers(state, currentChannelId, true);
}
return {
canManageUsers: canManageChannelMembers(state),
currentChannelId,
currentChannelMembers,
currentUserId: state.entities.users.currentUserId,
theme: getTheme(state),
};
};
}
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators({
getProfilesInChannel,
handleRemoveChannelMembers,
searchProfiles,
}, dispatch),
};
}
export default connect(makeMapStateToProps, mapDispatchToProps)(ChannelMembers);