Skip to content

Commit

Permalink
Merge pull request #21296 from bernhardoj/fix/19684-exclude-money-req…
Browse files Browse the repository at this point in the history
…uest-from-new-chat

Include money request report in search result only
  • Loading branch information
jasperhuangg authored Jun 23, 2023
2 parents 023c327 + 62ee492 commit 6183609
Showing 1 changed file with 8 additions and 3 deletions.
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

0 comments on commit 6183609

Please sign in to comment.