[MM-10055] Filter out deactivated user when viewing channel members (#1582)
* filter out deactivated user when viewing channel members * apply makeGetProfilesInChannel is filtering out the deactivated user/s * update using makeMapStateToProps
This commit is contained in:
parent
2092d778f0
commit
38b16b435f
2 changed files with 23 additions and 13 deletions
|
|
@ -28,7 +28,7 @@ class ChannelMembers extends PureComponent {
|
|||
intl: intlShape.isRequired,
|
||||
theme: PropTypes.object.isRequired,
|
||||
currentChannel: PropTypes.object,
|
||||
currentChannelMembers: PropTypes.array.isRequired,
|
||||
currentChannelMembers: PropTypes.array,
|
||||
currentUserId: PropTypes.string.isRequired,
|
||||
navigator: PropTypes.object,
|
||||
requestStatus: PropTypes.string,
|
||||
|
|
|
|||
|
|
@ -7,21 +7,31 @@ import {connect} from 'react-redux';
|
|||
import {handleRemoveChannelMembers} from 'app/actions/views/channel_members';
|
||||
import {getTheme} from 'mattermost-redux/selectors/entities/preferences';
|
||||
import {getCurrentChannel, canManageChannelMembers} from 'mattermost-redux/selectors/entities/channels';
|
||||
import {getProfilesInCurrentChannel} from 'mattermost-redux/selectors/entities/users';
|
||||
import {makeGetProfilesInChannel} from 'mattermost-redux/selectors/entities/users';
|
||||
import {getProfilesInChannel, searchProfiles} from 'mattermost-redux/actions/users';
|
||||
|
||||
import ChannelMembers from './channel_members';
|
||||
|
||||
function mapStateToProps(state) {
|
||||
return {
|
||||
theme: getTheme(state),
|
||||
currentChannel: getCurrentChannel(state) || {},
|
||||
currentChannelMembers: getProfilesInCurrentChannel(state),
|
||||
currentUserId: state.entities.users.currentUserId,
|
||||
requestStatus: state.requests.users.getProfilesInChannel.status,
|
||||
searchRequestStatus: state.requests.users.searchProfiles.status,
|
||||
removeMembersStatus: state.requests.channels.removeChannelMember.status,
|
||||
canManageUsers: canManageChannelMembers(state),
|
||||
function makeMapStateToProps() {
|
||||
const getChannelMembers = makeGetProfilesInChannel();
|
||||
|
||||
return (state) => {
|
||||
const currentChannel = getCurrentChannel(state) || {};
|
||||
let currentChannelMembers = [];
|
||||
if (currentChannel) {
|
||||
currentChannelMembers = getChannelMembers(state, currentChannel.id, true);
|
||||
}
|
||||
|
||||
return {
|
||||
theme: getTheme(state),
|
||||
currentChannel,
|
||||
currentChannelMembers,
|
||||
currentUserId: state.entities.users.currentUserId,
|
||||
requestStatus: state.requests.users.getProfilesInChannel.status,
|
||||
searchRequestStatus: state.requests.users.searchProfiles.status,
|
||||
removeMembersStatus: state.requests.channels.removeChannelMember.status,
|
||||
canManageUsers: canManageChannelMembers(state),
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -35,4 +45,4 @@ function mapDispatchToProps(dispatch) {
|
|||
};
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(ChannelMembers);
|
||||
export default connect(makeMapStateToProps, mapDispatchToProps)(ChannelMembers);
|
||||
|
|
|
|||
Loading…
Reference in a new issue