Skip to content

Commit

Permalink
Merge pull request #37907 from callstack-internal/jbroma/perf/report-…
Browse files Browse the repository at this point in the history
…display-name-slice

[Audit][Implementation] use max 5 names to generate Report name
  • Loading branch information
deetergp authored Mar 8, 2024
2 parents 5404018 + 5c24359 commit 2857c35
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2666,11 +2666,13 @@ function getReportName(report: OnyxEntry<Report>, policy: OnyxEntry<Policy> = nu
return formattedName;
}

// Not a room or PolicyExpenseChat, generate title from participants
const participantAccountIDs = report?.participantAccountIDs ?? [];
// Not a room or PolicyExpenseChat, generate title from first 5 other participants
const participantAccountIDs = report?.participantAccountIDs?.slice(0, 6) ?? [];
const participantsWithoutCurrentUser = participantAccountIDs.filter((accountID) => accountID !== currentUserAccountID);
const isMultipleParticipantReport = participantsWithoutCurrentUser.length > 1;

if (participantsWithoutCurrentUser.length > 5) {
participantsWithoutCurrentUser.pop();
}
return participantsWithoutCurrentUser.map((accountID) => getDisplayNameForParticipant(accountID, isMultipleParticipantReport)).join(', ');
}

Expand Down

0 comments on commit 2857c35

Please sign in to comment.