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

Commit

Permalink
Fixing guest disabled and no license on invitation modal (#3158)
Browse files Browse the repository at this point in the history
  • Loading branch information
jespino authored Jul 18, 2019
1 parent d1c8fbf commit 9b81bbb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion components/invitation_modal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {bindActionCreators} from 'redux';
import {getCurrentTeam} from 'mattermost-redux/selectors/entities/teams';
import {getMyChannels} from 'mattermost-redux/selectors/entities/channels';
import {haveIChannelPermission, haveITeamPermission} from 'mattermost-redux/selectors/entities/roles';
import {getConfig, getLicense} from 'mattermost-redux/selectors/entities/general';
import {getProfiles, searchProfiles as reduxSearchProfiles} from 'mattermost-redux/actions/users';
import {Permissions} from 'mattermost-redux/constants';

Expand All @@ -25,6 +26,8 @@ const searchProfiles = (term, options = {}) => {
};

function mapStateToProps(state) {
const config = getConfig(state);
const license = getLicense(state);
const channels = getMyChannels(state);
const currentTeam = getCurrentTeam(state);
const invitableChannels = channels.filter((channel) => {
Expand All @@ -36,7 +39,9 @@ function mapStateToProps(state) {
}
return haveIChannelPermission(state, {channel: channel.id, team: currentTeam.id, permission: Permissions.MANAGE_PUBLIC_CHANNEL_MEMBERS});
});
const canInviteGuests = haveITeamPermission(state, {team: currentTeam.id, permission: Permissions.INVITE_GUEST});
const guestAccountsEnabled = config.EnableGuestAccounts === 'true';
const isLicensed = license && license.IsLicensed === 'true';
const canInviteGuests = isLicensed && guestAccountsEnabled && haveITeamPermission(state, {team: currentTeam.id, permission: Permissions.INVITE_GUEST});
const canAddUsers = haveITeamPermission(state, {team: currentTeam.id, permission: Permissions.ADD_USER_TO_TEAM});
return {
invitableChannels,
Expand Down

0 comments on commit 9b81bbb

Please sign in to comment.