Skip to content

Commit

Permalink
Don't show Expensify DM in background behind modal , update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
francoisl committed Sep 4, 2024
1 parent 0e70445 commit 891c6ec
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ import type {Message, ReportActions} from '@src/types/onyx/ReportAction';
import type {Comment, TransactionChanges, WaypointCollection} from '@src/types/onyx/Transaction';
import {isEmptyObject} from '@src/types/utils/EmptyObject';
import type IconAsset from '@src/types/utils/IconAsset';
import AccountUtils from './AccountUtils';
import * as IOU from './actions/IOU';
import * as PolicyActions from './actions/Policy/Policy';
import * as store from './actions/ReimbursementAccount/store';
Expand Down Expand Up @@ -5981,7 +5980,10 @@ function shouldReportBeInOptionList({
return false;
}

if (report?.participants?.[CONST.ACCOUNT_ID.NOTIFICATIONS] && (!currentUserAccountID || !AccountUtils.isAccountIDOddNumber(currentUserAccountID))) {
// We used to use the system DM for A/B testing onboarding tasks, but now only create them in the Concierge chat. We
// still need to allow existing users who have tasks in the system DM to see them, but otherwise we don't need to
// show that chat
if (report?.participants?.[CONST.ACCOUNT_ID.NOTIFICATIONS] && isEmptyReport(report)) {
return false;
}

Expand Down Expand Up @@ -7619,22 +7621,22 @@ function shouldShowMerchantColumn(transactions: Transaction[]) {
}

/**
* Whether the report is a system chat or concierge chat, depending on the onboarding report ID or fallbacking
* to the user's account ID (used for A/B testing purposes).
* Whether a given report is used for onboarding tasks. In the past, it could be either the Concierge chat or the system
* DM, and we saved the report ID in the user's `onboarding` NVP. As a fallback for users who don't have the NVP, we now
* only use the Concierge chat.
*/
function isChatUsedForOnboarding(optionOrReport: OnyxEntry<Report> | OptionData): boolean {
// onboarding can be an array for old accounts and accounts created from olddot
if (onboarding && !Array.isArray(onboarding) && onboarding.chatReportID) {
return onboarding.chatReportID === optionOrReport?.reportID;
}

return AccountUtils.isAccountIDOddNumber(currentUserAccountID ?? -1)
? isSystemChat(optionOrReport)
: (optionOrReport as OptionData)?.isConciergeChat ?? isConciergeChatReport(optionOrReport);
return (optionOrReport as OptionData)?.isConciergeChat ?? isConciergeChatReport(optionOrReport);
}

/**
* Get the report (system or concierge chat) used for the user's onboarding process.
* Get the report used for the user's onboarding process. For most users it is the Concierge chat, however in the past
* we also used the system DM for A/B tests.
*/
function getChatUsedForOnboarding(): OnyxEntry<Report> {
return Object.values(ReportConnection.getAllReports() ?? {}).find(isChatUsedForOnboarding);
Expand Down

0 comments on commit 891c6ec

Please sign in to comment.