Skip to content
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
17 changes: 2 additions & 15 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8516,24 +8516,11 @@ function shouldReportBeInOptionList(params: ShouldReportBeInOptionListParams) {
/**
* Attempts to find a report in onyx with the provided list of participants. Does not include threads, task, expense, room, and policy expense chat.
*/
function getChatByParticipants(
newParticipantList: number[],
reports: OnyxCollection<Report> = allReports,
shouldIncludeGroupChats = false,
shouldExcludeClosedReports = false,
): OnyxEntry<Report> {
function getChatByParticipants(newParticipantList: number[], reports: OnyxCollection<Report> = allReports, shouldIncludeGroupChats = false): OnyxEntry<Report> {
const sortedNewParticipantList = newParticipantList.sort();
return Object.values(reports ?? {}).find((report) => {
const participantAccountIDs = Object.keys(report?.participants ?? {});

// This will get removed as part of https://github.com/Expensify/App/issues/59961
// eslint-disable-next-line deprecation/deprecation
const reportNameValuePairs = getReportNameValuePairs(report?.reportID);

if (shouldExcludeClosedReports && isArchivedReport(reportNameValuePairs)) {
return false;
}

// Skip if it's not a 1:1 chat
if (!shouldIncludeGroupChats && !isOneOnOneChat(report) && !isSystemChat(report)) {
return false;
Expand Down Expand Up @@ -10294,7 +10281,7 @@ function prepareOnboardingOnyxData(
const adminsChatReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${adminsChatReportID}`];
const targetChatReport = shouldPostTasksInAdminsRoom
? (adminsChatReport ?? {reportID: adminsChatReportID, policyID: onboardingPolicyID})
: getChatByParticipants([CONST.ACCOUNT_ID.CONCIERGE, currentUserAccountID ?? CONST.DEFAULT_NUMBER_ID], allReports, false, true);
: getChatByParticipants([CONST.ACCOUNT_ID.CONCIERGE, currentUserAccountID ?? CONST.DEFAULT_NUMBER_ID], allReports, false);
const {reportID: targetChatReportID = '', policyID: targetChatPolicyID = ''} = targetChatReport ?? {};

if (!targetChatReportID) {
Expand Down