forked from Ivasoft/mattermost-mobile
Fix undefined object issue in Jump to Conversation (#736)
This commit is contained in:
committed by
Harrison Healey
parent
643925469b
commit
422abe4cb7
@@ -25,6 +25,7 @@ import ChannelDrawerItem from 'app/components/channel_drawer/channels_list/chann
|
||||
class FilteredList extends Component {
|
||||
static propTypes = {
|
||||
actions: PropTypes.shape({
|
||||
getProfilesInTeam: PropTypes.func.isRequired,
|
||||
makeGroupMessageVisibleIfNecessary: PropTypes.func.isRequired,
|
||||
searchChannels: PropTypes.func.isRequired,
|
||||
searchProfiles: PropTypes.func.isRequired
|
||||
@@ -44,6 +45,7 @@ class FilteredList extends Component {
|
||||
),
|
||||
searchOrder: PropTypes.array.isRequired,
|
||||
pastDirectMessages: PropTypes.array,
|
||||
restrictDms: PropTypes.bool.isRequired,
|
||||
statuses: PropTypes.object,
|
||||
styles: PropTypes.object.isRequired,
|
||||
term: PropTypes.string,
|
||||
@@ -63,6 +65,12 @@ class FilteredList extends Component {
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (this.props.restrictDms) {
|
||||
this.props.actions.getProfilesInTeam(this.props.currentTeam.id);
|
||||
}
|
||||
}
|
||||
|
||||
shouldComponentUpdate(nextProps, nextState) {
|
||||
return !deepEqual(this.props, nextProps, {strict: true}) || !deepEqual(this.state, nextState, {strict: true});
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import {connect} from 'react-redux';
|
||||
import {createSelector} from 'reselect';
|
||||
|
||||
import {searchChannels} from 'mattermost-redux/actions/channels';
|
||||
import {searchProfiles} from 'mattermost-redux/actions/users';
|
||||
import {getProfilesInTeam, searchProfiles} from 'mattermost-redux/actions/users';
|
||||
import {makeGroupMessageVisibleIfNecessary} from 'mattermost-redux/actions/preferences';
|
||||
import {General} from 'mattermost-redux/constants';
|
||||
import {getGroupChannels, getOtherChannels} from 'mattermost-redux/selectors/entities/channels';
|
||||
@@ -29,10 +29,11 @@ function mapStateToProps(state, ownProps) {
|
||||
const {currentUserId} = state.entities.users;
|
||||
|
||||
let profiles;
|
||||
if (getConfig(state).RestrictDirectMessage === General.RESTRICT_DIRECT_MESSAGE_ANY) {
|
||||
profiles = getUsers(state);
|
||||
} else {
|
||||
const restrictDms = getConfig(state).RestrictDirectMessage !== General.RESTRICT_DIRECT_MESSAGE_ANY;
|
||||
if (restrictDms) {
|
||||
profiles = getProfilesInCurrentTeam(state);
|
||||
} else {
|
||||
profiles = getUsers(state);
|
||||
}
|
||||
|
||||
const searchOrder = Config.DrawerSearchOrder ? Config.DrawerSearchOrder : DEFAULT_SEARCH_ORDER;
|
||||
@@ -46,6 +47,7 @@ function mapStateToProps(state, ownProps) {
|
||||
statuses: getUserStatuses(state),
|
||||
searchOrder,
|
||||
pastDirectMessages: pastDirectMessages(state),
|
||||
restrictDms,
|
||||
...ownProps
|
||||
};
|
||||
}
|
||||
@@ -53,6 +55,7 @@ function mapStateToProps(state, ownProps) {
|
||||
function mapDispatchToProps(dispatch) {
|
||||
return {
|
||||
actions: bindActionCreators({
|
||||
getProfilesInTeam,
|
||||
makeGroupMessageVisibleIfNecessary,
|
||||
searchChannels,
|
||||
searchProfiles
|
||||
|
||||
Reference in New Issue
Block a user