Skip to content

Commit

Permalink
Use correct consts and functions for expensify emails
Browse files Browse the repository at this point in the history
  • Loading branch information
Beamanator committed Jun 15, 2023
1 parent 320bcca commit ff4df6b
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 19 deletions.
10 changes: 0 additions & 10 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -581,15 +581,6 @@ function chatIncludesConcierge(report) {
return report.participantAccountIDs && _.contains(report.participantAccountIDs, CONST.ACCOUNT_ID.CONCIERGE);
}

/**
* Returns true if there is any automated expensify account in emails
* @param {Array} emails
* @returns {Boolean}
*/
function hasAutomatedExpensifyEmails(emails) {
return _.intersection(emails, CONST.EXPENSIFY_EMAILS).length > 0;
}

/**
* Returns true if there is any automated expensify account in accountIDs
* @param {Array} accountIDs
Expand Down Expand Up @@ -2260,7 +2251,6 @@ export {
isPublicAnnounceRoom,
isConciergeChatReport,
isCurrentUserTheOnlyParticipant,
hasAutomatedExpensifyEmails,
hasAutomatedExpensifyAccountIDs,
hasExpensifyGuidesEmails,
hasOutstandingIOU,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/NewChatPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class NewChatPage extends Component {
this.createChat = this.createChat.bind(this);
this.createGroup = this.createGroup.bind(this);
this.updateOptionsWithSearchTerm = this.updateOptionsWithSearchTerm.bind(this);
this.excludedGroupEmails = _.without(CONST.EXPENSIFY_ACCOUNT_IDS, CONST.ACCOUNT_ID.CONCIERGE);
this.excludedGroupEmails = _.without(CONST.EXPENSIFY_EMAILS, CONST.EMAIL.CONCIERGE);

const {recentReports, personalDetails, userToInvite} = OptionsListUtils.getNewChatOptions(
props.reports,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ProfilePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function ProfilePage(props) {

// If we have a reportID param this means that we
// arrived here via the ParticipantsPage and should be allowed to navigate back to it
const shouldShowLocalTime = !ReportUtils.hasAutomatedExpensifyEmails([accountID]) && !_.isEmpty(timezone);
const shouldShowLocalTime = !ReportUtils.hasAutomatedExpensifyAccountIDs([accountID]) && !_.isEmpty(timezone);

let pronouns = lodashGet(details, 'pronouns', '');
if (pronouns && pronouns.startsWith(CONST.PRONOUNS.PREFIX)) {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/HeaderView.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function HeaderView(props) {
const title = ReportUtils.getReportName(reportHeaderData);
const subtitle = ReportUtils.getChatRoomSubtitle(reportHeaderData);
const isConcierge = participants.length === 1 && _.contains(participants, CONST.ACCOUNT_ID.CONCIERGE);
const isAutomatedExpensifyAccount = participants.length === 1 && ReportUtils.hasAutomatedExpensifyEmails(participants);
const isAutomatedExpensifyAccount = participants.length === 1 && ReportUtils.hasAutomatedExpensifyAccountIDs(participants);
const guideCalendarLink = lodashGet(props.account, 'guideCalendarLink');

// We hide the button when we are chatting with an automated Expensify account since it's not possible to contact
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class MoneyRequestParticipantsSelector extends Component {
this.props.betas,
searchTerm,
[],
CONST.EXPENSIFY_ACCOUNT_IDS,
CONST.EXPENSIFY_EMAILS,

// If we are using this component in the "Request money" flow then we pass the includeOwnedWorkspaceChats argument so that the current user
// sees the option to request money from their admin on their own Workspace Chat.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class MoneyRequestParticipantsSplitSelector extends Component {
props.betas,
'',
props.participants,
CONST.EXPENSIFY_ACCOUNT_IDS,
CONST.EXPENSIFY_EMAILS,
);

this.state = {
Expand Down Expand Up @@ -149,7 +149,7 @@ class MoneyRequestParticipantsSplitSelector extends Component {
this.props.betas,
searchTerm,
this.props.participants,
CONST.EXPENSIFY_ACCOUNT_IDS,
CONST.EXPENSIFY_EMAILS,
);
this.setState({
searchTerm,
Expand Down Expand Up @@ -190,7 +190,7 @@ class MoneyRequestParticipantsSplitSelector extends Component {
this.props.betas,
isOptionInList ? prevState.searchTerm : '',
newSelectedOptions,
CONST.EXPENSIFY_ACCOUNT_IDS,
CONST.EXPENSIFY_EMAILS,
);
return {
recentReports,
Expand Down
4 changes: 2 additions & 2 deletions src/pages/tasks/TaskAssigneeSelectorModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function TaskAssigneeSelectorModal(props) {
const [filteredCurrentUserOption, setFilteredCurrentUserOption] = useState(null);

useEffect(() => {
const results = OptionsListUtils.getNewChatOptions(props.reports, props.personalDetails, props.betas, '', [], CONST.EXPENSIFY_ACCOUNT_IDS, false);
const results = OptionsListUtils.getNewChatOptions(props.reports, props.personalDetails, props.betas, '', [], CONST.EXPENSIFY_EMAILS, false);

setFilteredRecentReports(results.recentReports);
setFilteredPersonalDetails(results.personalDetails);
Expand All @@ -93,7 +93,7 @@ function TaskAssigneeSelectorModal(props) {
props.betas,
searchValue.trim(),
[],
CONST.EXPENSIFY_ACCOUNT_IDS,
CONST.EXPENSIFY_EMAILS,
false,
);

Expand Down

0 comments on commit ff4df6b

Please sign in to comment.