[MM-14751] Take group_constrained into account when adding users to channels (#2737)
* [MM-14751] Take group_constrained into account when adding users to channels * Pass current channel properties instead of the complete object * Point package.json to new mattermost-redux
This commit is contained in:
parent
5bf96272ae
commit
35e4a2b73a
4 changed files with 17 additions and 8 deletions
|
|
@ -34,6 +34,7 @@ export default class ChannelAddMembers extends PureComponent {
|
|||
searchProfiles: PropTypes.func.isRequired,
|
||||
}).isRequired,
|
||||
currentChannelId: PropTypes.string.isRequired,
|
||||
currentChannelGroupConstrained: PropTypes.bool,
|
||||
currentTeamId: PropTypes.string.isRequired,
|
||||
currentUserId: PropTypes.string.isRequired,
|
||||
profilesNotInChannel: PropTypes.array.isRequired,
|
||||
|
|
@ -41,6 +42,10 @@ export default class ChannelAddMembers extends PureComponent {
|
|||
theme: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
currentChannelGroupConstrained: false,
|
||||
};
|
||||
|
||||
static contextTypes = {
|
||||
intl: intlShape.isRequired,
|
||||
};
|
||||
|
|
@ -112,11 +117,12 @@ export default class ChannelAddMembers extends PureComponent {
|
|||
const {loading, term} = this.state;
|
||||
if (this.next && !loading && !term) {
|
||||
this.setState({loading: true}, () => {
|
||||
const {actions, currentChannelId, currentTeamId} = this.props;
|
||||
const {actions, currentChannelId, currentChannelGroupConstrained, currentTeamId} = this.props;
|
||||
|
||||
actions.getProfilesNotInChannel(
|
||||
currentTeamId,
|
||||
currentChannelId,
|
||||
currentChannelGroupConstrained,
|
||||
this.page + 1,
|
||||
General.PROFILE_CHUNK_SIZE
|
||||
).then(this.onProfilesLoaded);
|
||||
|
|
@ -258,8 +264,8 @@ export default class ChannelAddMembers extends PureComponent {
|
|||
};
|
||||
|
||||
searchProfiles = (term) => {
|
||||
const {actions, currentChannelId, currentTeamId} = this.props;
|
||||
const options = {not_in_channel_id: currentChannelId, team_id: currentTeamId};
|
||||
const {actions, currentChannelId, currentChannelGroupConstrained, currentTeamId} = this.props;
|
||||
const options = {not_in_channel_id: currentChannelId, team_id: currentTeamId, group_constrained: currentChannelGroupConstrained};
|
||||
this.setState({loading: true});
|
||||
|
||||
actions.searchProfiles(term.toLowerCase(), options).then(({data}) => {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import {connect} from 'react-redux';
|
|||
|
||||
import {getTeamStats} from 'mattermost-redux/actions/teams';
|
||||
import {getProfilesNotInChannel, searchProfiles} from 'mattermost-redux/actions/users';
|
||||
import {getCurrentChannelId} from 'mattermost-redux/selectors/entities/channels';
|
||||
import {getCurrentChannel} from 'mattermost-redux/selectors/entities/channels';
|
||||
import {getTheme} from 'mattermost-redux/selectors/entities/preferences';
|
||||
import {getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams';
|
||||
import {getCurrentUserId, getProfilesNotInCurrentChannel} from 'mattermost-redux/selectors/entities/users';
|
||||
|
|
@ -16,8 +16,11 @@ import {handleAddChannelMembers} from 'app/actions/views/channel_add_members';
|
|||
import ChannelAddMembers from './channel_add_members';
|
||||
|
||||
function mapStateToProps(state) {
|
||||
const currentChannel = getCurrentChannel(state);
|
||||
|
||||
return {
|
||||
currentChannelId: getCurrentChannelId(state),
|
||||
currentChannelId: currentChannel.id,
|
||||
currentChannelGroupConstrained: currentChannel.group_constrained,
|
||||
currentTeamId: getCurrentTeamId(state),
|
||||
currentUserId: getCurrentUserId(state),
|
||||
profilesNotInChannel: getProfilesNotInCurrentChannel(state),
|
||||
|
|
|
|||
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -13184,8 +13184,8 @@
|
|||
"integrity": "sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A=="
|
||||
},
|
||||
"mattermost-redux": {
|
||||
"version": "github:mattermost/mattermost-redux#57061465c52c27bc25f646b1de8c85915aa62415",
|
||||
"from": "github:mattermost/mattermost-redux#57061465c52c27bc25f646b1de8c85915aa62415",
|
||||
"version": "github:mattermost/mattermost-redux#429ac99932207fa21441d05482e36a0597c80515",
|
||||
"from": "github:mattermost/mattermost-redux#429ac99932207fa21441d05482e36a0597c80515",
|
||||
"requires": {
|
||||
"deep-equal": "1.0.1",
|
||||
"eslint-plugin-header": "3.0.0",
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
"intl": "1.2.5",
|
||||
"jail-monkey": "2.2.0",
|
||||
"jsc-android": "241213.1.0",
|
||||
"mattermost-redux": "github:mattermost/mattermost-redux#57061465c52c27bc25f646b1de8c85915aa62415",
|
||||
"mattermost-redux": "github:mattermost/mattermost-redux#429ac99932207fa21441d05482e36a0597c80515",
|
||||
"mime-db": "1.40.0",
|
||||
"moment-timezone": "0.5.25",
|
||||
"prop-types": "15.7.2",
|
||||
|
|
|
|||
Loading…
Reference in a new issue