diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index 4ad79c30e86d..b952fbe9af4e 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -175,6 +175,7 @@ type GetOptionsConfig = { recentlyUsedPolicyReportFieldOptions?: string[]; transactionViolations?: OnyxCollection; includeInvoiceRooms?: boolean; + includeDomainEmail?: boolean; }; type GetUserToInviteConfig = { @@ -1802,6 +1803,7 @@ function getOptions( policyReportFieldOptions = [], recentlyUsedPolicyReportFieldOptions = [], includeInvoiceRooms = false, + includeDomainEmail = false, }: GetOptionsConfig, ): Options { if (includeCategories) { @@ -1878,6 +1880,8 @@ function getOptions( isInFocusMode: false, excludeEmptyChats: false, includeSelfDM, + login: option.login, + includeDomainEmail, }); }); @@ -1951,7 +1955,9 @@ function getOptions( return option; }); - const havingLoginPersonalDetails = includeP2P ? options.personalDetails.filter((detail) => !!detail?.login && !!detail.accountID && !detail?.isOptimisticPersonalDetail) : []; + const havingLoginPersonalDetails = includeP2P + ? options.personalDetails.filter((detail) => !!detail?.login && !!detail.accountID && !detail?.isOptimisticPersonalDetail && (includeDomainEmail || !Str.isDomainEmail(detail.login))) + : []; let allPersonalDetailsOptions = havingLoginPersonalDetails; if (sortPersonalDetailsByAlphaAsc) { diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 2830096e0e8f..8dfc05e911e5 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -5409,6 +5409,8 @@ function shouldReportBeInOptionList({ excludeEmptyChats, doesReportHaveViolations, includeSelfDM = false, + login, + includeDomainEmail = false, }: { report: OnyxEntry; currentReportId: string; @@ -5418,6 +5420,8 @@ function shouldReportBeInOptionList({ excludeEmptyChats: boolean; doesReportHaveViolations: boolean; includeSelfDM?: boolean; + login?: string; + includeDomainEmail?: boolean; }) { const isInDefaultMode = !isInFocusMode; // Exclude reports that have no data because there wouldn't be anything to show in the option item. @@ -5521,6 +5525,11 @@ function shouldReportBeInOptionList({ if (isSelfDM(report)) { return includeSelfDM; } + + if (Str.isDomainEmail(login ?? '') && !includeDomainEmail) { + return false; + } + const parentReportAction = ReportActionsUtils.getParentReportAction(report); // Hide chat threads where the parent message is pending removal