Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly exclude system emails from inviting in workspaces #5951

Merged
merged 5 commits into from
Oct 22, 2021
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
28 changes: 0 additions & 28 deletions src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,38 +467,10 @@ const EXPENSIFY_EMAILS = [
CONST.EMAIL.STUDENT_AMBASSADOR,
CONST.EMAIL.QA_TRAVIS,
CONST.EMAIL.SVFG,
];

const EXCLUDED_GROUP_EMAILS = [
CONST.EMAIL.CONTRIBUTORS,
CONST.EMAIL.FIRST_RESPONDER,
CONST.EMAIL.HELP,
CONST.EMAIL.QA,
CONST.EMAIL.CHRONOS,
CONST.EMAIL.BILLS,
CONST.EMAIL.STUDENT_AMBASSADOR,
CONST.EMAIL.QA_TRAVIS,
CONST.EMAIL.SVFG,
];

const EXCLUDED_IOU_EMAILS = [
CONST.EMAIL.CONCIERGE,
CONST.EMAIL.CONTRIBUTORS,
CONST.EMAIL.FIRST_RESPONDER,
CONST.EMAIL.HELP,
CONST.EMAIL.QA,
CONST.EMAIL.CHRONOS,
CONST.EMAIL.RECEIPTS,
CONST.EMAIL.BILLS,
CONST.EMAIL.STUDENT_AMBASSADOR,
CONST.EMAIL.QA_TRAVIS,
CONST.EMAIL.SVFG,
CONST.EMAIL.INTEGRATION_TESTING_CREDS,
];

export {
EXPENSIFY_EMAILS,
EXCLUDED_GROUP_EMAILS,
EXCLUDED_IOU_EMAILS,
};
export default CONST;
13 changes: 9 additions & 4 deletions src/pages/NewChatPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ONYXKEYS from '../ONYXKEYS';
import styles from '../styles/styles';
import {fetchOrCreateChatReport} from '../libs/actions/Report';
import KeyboardSpacer from '../components/KeyboardSpacer';
import CONST, {EXCLUDED_GROUP_EMAILS} from '../CONST';
import CONST, {EXPENSIFY_EMAILS} from '../CONST';
import withWindowDimensions, {windowDimensionsPropTypes} from '../components/withWindowDimensions';
import HeaderWithCloseButton from '../components/HeaderWithCloseButton';
import Navigation from '../libs/Navigation/Navigation';
Expand Down Expand Up @@ -60,6 +60,11 @@ class NewChatPage extends Component {
this.createGroup = this.createGroup.bind(this);
this.toggleGroupOptionOrCreateChat = this.toggleGroupOptionOrCreateChat.bind(this);
this.createNewChat = this.createNewChat.bind(this);
this.excludedGroupEmails = _.without(EXPENSIFY_EMAILS, [
CONST.EMAIL.CONCIERGE,
CONST.EMAIL.RECEIPTS,
CONST.EMAIL.INTEGRATION_TESTING_CREDS,
]);

const {
recentReports,
Expand All @@ -71,7 +76,7 @@ class NewChatPage extends Component {
props.betas,
'',
[],
this.props.isGroupChat ? EXCLUDED_GROUP_EMAILS : [],
this.props.isGroupChat ? this.excludedGroupEmails : [],
);
this.state = {
searchValue: '',
Expand Down Expand Up @@ -171,7 +176,7 @@ class NewChatPage extends Component {
this.props.betas,
isOptionInList ? prevState.searchValue : '',
newSelectedOptions,
EXCLUDED_GROUP_EMAILS,
this.excludedGroupEmails,
);

return {
Expand Down Expand Up @@ -243,7 +248,7 @@ class NewChatPage extends Component {
this.props.betas,
searchValue,
[],
this.props.isGroupChat ? EXCLUDED_GROUP_EMAILS : [],
this.props.isGroupChat ? this.excludedGroupEmails : [],
);
this.setState({
searchValue,
Expand Down
4 changes: 2 additions & 2 deletions src/pages/home/report/ReportActionCompose.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import EmojiPickerMenu from './EmojiPickerMenu';
import withWindowDimensions, {windowDimensionsPropTypes} from '../../../components/withWindowDimensions';
import withDrawerState from '../../../components/withDrawerState';
import getButtonState from '../../../libs/getButtonState';
import CONST, {EXCLUDED_IOU_EMAILS} from '../../../CONST';
import CONST, {EXPENSIFY_EMAILS} from '../../../CONST';
import canFocusInputOnScreenFocus from '../../../libs/canFocusInputOnScreenFocus';
import variables from '../../../styles/variables';
import withLocalize, {withLocalizePropTypes} from '../../../components/withLocalize';
Expand Down Expand Up @@ -459,7 +459,7 @@ class ReportActionCompose extends React.Component {
// eslint-disable-next-line no-unused-vars
const reportParticipants = lodashGet(this.props.report, 'participants', []);
const hasMultipleParticipants = reportParticipants.length > 1;
const hasExcludedIOUEmails = lodashIntersection(reportParticipants, EXCLUDED_IOU_EMAILS).length > 0;
const hasExcludedIOUEmails = lodashIntersection(reportParticipants, EXPENSIFY_EMAILS).length > 0;
const reportRecipient = this.props.personalDetails[reportParticipants[0]];
const currentUserTimezone = lodashGet(this.props.myPersonalDetails, 'timezone', CONST.DEFAULT_TIME_ZONE);
const reportRecipientTimezone = lodashGet(reportRecipient, 'timezone', CONST.DEFAULT_TIME_ZONE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import OptionsSelector from '../../../../components/OptionsSelector';
import ONYXKEYS from '../../../../ONYXKEYS';
import withLocalize, {withLocalizePropTypes} from '../../../../components/withLocalize';
import compose from '../../../../libs/compose';
import {EXCLUDED_IOU_EMAILS} from '../../../../CONST';
import {EXPENSIFY_EMAILS} from '../../../../CONST';
import personalDetailsPropType from '../../../personalDetailsPropType';

const propTypes = {
Expand Down Expand Up @@ -48,7 +48,7 @@ class IOUParticipantsRequest extends Component {
props.betas,
'',
[],
EXCLUDED_IOU_EMAILS,
EXPENSIFY_EMAILS,
);

this.state = {
Expand Down Expand Up @@ -126,7 +126,7 @@ class IOUParticipantsRequest extends Component {
this.props.betas,
searchValue,
[],
EXCLUDED_IOU_EMAILS,
EXPENSIFY_EMAILS,
);
this.setState({
searchValue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import ONYXKEYS from '../../../../ONYXKEYS';
import styles from '../../../../styles/styles';
import OptionsSelector from '../../../../components/OptionsSelector';
import {getHeaderMessage, getNewChatOptions, isCurrentUser} from '../../../../libs/OptionsListUtils';
import CONST, {EXCLUDED_IOU_EMAILS} from '../../../../CONST';
import CONST, {EXPENSIFY_EMAILS} from '../../../../CONST';
import withLocalize, {withLocalizePropTypes} from '../../../../components/withLocalize';
import compose from '../../../../libs/compose';
import Button from '../../../../components/Button';
Expand Down Expand Up @@ -72,7 +72,7 @@ class IOUParticipantsSplit extends Component {
props.betas,
'',
props.participants,
EXCLUDED_IOU_EMAILS,
EXPENSIFY_EMAILS,
);

this.state = {
Expand Down Expand Up @@ -173,7 +173,7 @@ class IOUParticipantsSplit extends Component {
this.props.betas,
isOptionInList ? prevState.searchValue : '',
newSelectedOptions,
EXCLUDED_IOU_EMAILS,
EXPENSIFY_EMAILS,
);
return {
recentReports,
Expand Down Expand Up @@ -215,7 +215,7 @@ class IOUParticipantsSplit extends Component {
this.props.betas,
searchValue,
[],
EXCLUDED_IOU_EMAILS,
EXPENSIFY_EMAILS,
);
this.setState({
searchValue,
Expand Down
4 changes: 2 additions & 2 deletions src/pages/workspace/WorkspaceInvitePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import KeyboardAvoidingView from '../../components/KeyboardAvoidingView';
import FormAlertWithSubmitButton from '../../components/FormAlertWithSubmitButton';
import OptionsSelector from '../../components/OptionsSelector';
import {getNewChatOptions, getHeaderMessage} from '../../libs/OptionsListUtils';
import CONST, {EXCLUDED_GROUP_EMAILS} from '../../CONST';
import CONST, {EXPENSIFY_EMAILS} from '../../CONST';
import FullScreenLoadingIndicator from '../../components/FullscreenLoadingIndicator';
import {openExternalLink} from '../../libs/actions/Link';
import Text from '../../components/Text';
Expand Down Expand Up @@ -100,7 +100,7 @@ class WorkspaceInvitePage extends React.Component {

getExcludedUsers() {
const policyEmployeeList = lodashGet(this.props, 'policy.employeeList', []);
return [...EXCLUDED_GROUP_EMAILS, ...policyEmployeeList];
marcaaron marked this conversation as resolved.
Show resolved Hide resolved
return [...EXPENSIFY_EMAILS, ...policyEmployeeList];
}

/**
Expand Down