Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

MM-15200: Only show permissions schemes prompt when adding a team in … #2724

Merged
merged 1 commit into from
Apr 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {FormattedMessage} from 'react-intl';

import Permissions from 'mattermost-redux/constants/permissions';

import {PermissionsScope} from 'utils/constants.jsx';
import {PermissionsScope, ModalIdentifiers} from 'utils/constants.jsx';
import {localizeMessage} from 'utils/utils.jsx';
import {t} from 'utils/i18n';

Expand Down Expand Up @@ -394,6 +394,7 @@ export default class PermissionTeamSchemeSettings extends React.Component {
<div className='wrapper--fixed'>
{this.state.addTeamOpen &&
<TeamSelectorModal
modalID={ModalIdentifiers.ADD_TEAMS_TO_SCHEME}
onModalDismissed={this.closeAddTeam}
onTeamsSelected={this.addTeams}
currentSchemeId={this.props.schemeId}
Expand Down
5 changes: 3 additions & 2 deletions components/team_selector_modal/team_selector_modal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import React from 'react';
import {Modal} from 'react-bootstrap';
import {FormattedMessage} from 'react-intl';

import Constants from 'utils/constants.jsx';
import Constants, {ModalIdentifiers} from 'utils/constants.jsx';
import {localizeMessage} from 'utils/utils.jsx';

import MultiSelect from 'components/multiselect/multiselect.jsx';
Expand All @@ -25,6 +25,7 @@ export default class TeamSelectorModal extends React.Component {
teams: PropTypes.array.isRequired,
onModalDismissed: PropTypes.func,
onTeamsSelected: PropTypes.func,
modalID: PropTypes.string,
actions: PropTypes.shape({
loadTeams: PropTypes.func.isRequired,
setModalSearchTerm: PropTypes.func.isRequired,
Expand Down Expand Up @@ -98,7 +99,7 @@ export default class TeamSelectorModal extends React.Component {
}

addValue = (value, confirmed = false) => {
if (value.scheme_id !== null && value.scheme_id !== '' && !confirmed) {
if (this.props.modalID === ModalIdentifiers.ADD_TEAMS_TO_SCHEME && value.scheme_id !== null && value.scheme_id !== '' && !confirmed) {
this.setState({confirmAddModal: true, confirmAddTeam: value});
return;
}
Expand Down
1 change: 1 addition & 0 deletions utils/constants.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ export const ModalIdentifiers = {
REMOVED_FROM_CHANNEL: 'removed_from_channel',
EMAIL_INVITE: 'email_invite',
INTERACTIVE_DIALOG: 'interactive_dialog',
ADD_TEAMS_TO_SCHEME: 'add_teams_to_scheme',
};

export const UserStatuses = {
Expand Down