Skip to content

Commit

Permalink
allow displaying default rooms with empty participants when searching…
Browse files Browse the repository at this point in the history
… for reports
  • Loading branch information
jasperhuangg committed Jun 12, 2024
1 parent a451de4 commit 30c08c8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/libs/OptionsListUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ type GetOptionsConfig = {
recentlyUsedPolicyReportFieldOptions?: string[];
transactionViolations?: OnyxCollection<TransactionViolation[]>;
includeInvoiceRooms?: boolean;
isSearchingForReports?: boolean;
};

type GetUserToInviteConfig = {
Expand Down Expand Up @@ -1749,6 +1750,7 @@ function getOptions(
policyReportFieldOptions = [],
recentlyUsedPolicyReportFieldOptions = [],
includeInvoiceRooms = false,
isSearchingForReports = false,
}: GetOptionsConfig,
): Options {
if (includeCategories) {
Expand Down Expand Up @@ -1831,6 +1833,7 @@ function getOptions(
isInFocusMode: false,
excludeEmptyChats: false,
includeSelfDM,
isSearchingForReports
});
});

Expand Down Expand Up @@ -2082,6 +2085,7 @@ function getSearchOptions(options: OptionList, searchValue = '', betas: Beta[] =
includeMoneyRequests: true,
includeTasks: true,
includeSelfDM: true,
isSearchingForReports: true,
});
Timing.end(CONST.TIMING.LOAD_SEARCH_OPTIONS);
Performance.markEnd(CONST.TIMING.LOAD_SEARCH_OPTIONS);
Expand Down
5 changes: 4 additions & 1 deletion src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5334,6 +5334,7 @@ function shouldReportBeInOptionList({
excludeEmptyChats,
doesReportHaveViolations,
includeSelfDM = false,
isSearchingForReports = false,
}: {
report: OnyxEntry<Report>;
currentReportId: string;
Expand All @@ -5343,6 +5344,7 @@ function shouldReportBeInOptionList({
excludeEmptyChats: boolean;
doesReportHaveViolations: boolean;
includeSelfDM?: boolean;
isSearchingForReports?: boolean;
}) {
const isInDefaultMode = !isInFocusMode;
// Exclude reports that have no data because there wouldn't be anything to show in the option item.
Expand Down Expand Up @@ -5370,7 +5372,8 @@ function shouldReportBeInOptionList({
!isSelfDM(report) &&
!isSystemChat(report) &&
!isGroupChat(report) &&
!isInvoiceRoom(report))
!isInvoiceRoom(report) &&
(!isSearchingForReports && isDefaultRoom(report)))
) {
return false;
}
Expand Down

0 comments on commit 30c08c8

Please sign in to comment.