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 on invitation modal
Browse files Browse the repository at this point in the history
  • Loading branch information
jespino committed Jul 18, 2019
1 parent d1c8fbf commit 6b94536
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 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} 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,7 @@ const searchProfiles = (term, options = {}) => {
};

function mapStateToProps(state) {
const config = getConfig(state);
const channels = getMyChannels(state);
const currentTeam = getCurrentTeam(state);
const invitableChannels = channels.filter((channel) => {
Expand All @@ -36,7 +38,8 @@ 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 canInviteGuests = 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 6b94536

Please sign in to comment.