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

Include money request report in search result only #21296

Merged
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
11 changes: 8 additions & 3 deletions src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,7 @@ function getOptions(
includeOwnedWorkspaceChats = false,
includeThreads = false,
includeTasks = false,
includeMoneyRequests = false,
},
) {
if (!isPersonalDetailsReady(personalDetails)) {
Expand Down Expand Up @@ -644,6 +645,7 @@ function getOptions(
const isChatRoom = ReportUtils.isChatRoom(report);
const isTaskReport = ReportUtils.isTaskReport(report);
const isPolicyExpenseChat = ReportUtils.isPolicyExpenseChat(report);
const isMoneyRequestReport = ReportUtils.isMoneyRequestReport(report);
const accountIDs = report.participantAccountIDs || [];

if (isPolicyExpenseChat && report.isOwnPolicyExpenseChat && !includeOwnedWorkspaceChats) {
Expand All @@ -658,6 +660,10 @@ function getOptions(
return;
}

if (isMoneyRequestReport && !includeMoneyRequests) {
return;
}

// Save the report in the map if this is a single participant so we can associate the reportID with the
// personal detail option later. Individuals should not be associated with single participant
// policyExpenseChats or chatRooms since those are not people.
Expand Down Expand Up @@ -853,6 +859,7 @@ function getSearchOptions(reports, personalDetails, searchValue = '', betas) {
forcePolicyNamePreview: true,
includeOwnedWorkspaceChats: true,
includeThreads: true,
includeMoneyRequests: true,
});
}

Expand Down Expand Up @@ -935,9 +942,7 @@ function getNewChatOptions(reports, personalDetails, betas = [], searchValue = '
*/

function getShareDestinationOptions(reports, personalDetails, betas = [], searchValue = '', selectedOptions = [], excludeLogins = [], includeOwnedWorkspaceChats = true) {
// We want to filter out any IOUs or expense reports
const filteredReports = _.filter(reports, (report) => !ReportUtils.isMoneyRequestReport(report));
return getOptions(filteredReports, personalDetails, {
return getOptions(reports, personalDetails, {
betas,
searchInputValue: searchValue.trim(),
selectedOptions,
Expand Down