diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index 00e00e3b4a17..75806077daca 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -541,7 +541,7 @@ function createOption(accountIDs, personalDetails, report, reportActions = {}, { } reportName = ReportUtils.getReportName(report); } else { - reportName = ReportUtils.getDisplayNameForParticipant(accountIDs[0], false); + reportName = ReportUtils.getDisplayNameForParticipant(accountIDs[0]); result.keyForList = String(accountIDs[0]); result.alternateText = LocalePhoneNumber.formatPhoneNumber(lodashGet(personalDetails, [accountIDs[0], 'login'], '')); } diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 3188c2917c6a..5cf7396c6669 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -1164,7 +1164,6 @@ function getPersonalDetailsForAccountID(accountID) { return ( (allPersonalDetails && allPersonalDetails[accountID]) || { avatar: UserUtils.getDefaultAvatar(accountID), - isOptimisticPersonalDetail: true, } ); } @@ -1174,38 +1173,27 @@ function getPersonalDetailsForAccountID(accountID) { * * @param {Number} accountID * @param {Boolean} [shouldUseShortForm] - * @param {Boolean} shouldFallbackToHidden * @returns {String} */ -function getDisplayNameForParticipant(accountID, shouldUseShortForm = false, shouldFallbackToHidden = true) { +function getDisplayNameForParticipant(accountID, shouldUseShortForm = false) { if (!accountID) { return ''; } const personalDetails = getPersonalDetailsForAccountID(accountID); - // this is to check if account is an invite/optimistically created one - // and prevent from falling back to 'Hidden', so a correct value is shown - // when searching for a new user - if (lodashGet(personalDetails, 'isOptimisticPersonalDetail') === true) { - return personalDetails.login || ''; - } const longName = personalDetails.displayName; const shortName = personalDetails.firstName || longName; - if (!longName && !personalDetails.login && shouldFallbackToHidden) { - return Localize.translateLocal('common.hidden'); - } return shouldUseShortForm ? shortName : longName; } /** * @param {Object} personalDetailsList * @param {Boolean} isMultipleParticipantReport - * @param {Boolean} shouldFallbackToHidden * @returns {Array} */ -function getDisplayNamesWithTooltips(personalDetailsList, isMultipleParticipantReport, shouldFallbackToHidden) { +function getDisplayNamesWithTooltips(personalDetailsList, isMultipleParticipantReport) { return _.map(personalDetailsList, (user) => { const accountID = Number(user.accountID); - const displayName = getDisplayNameForParticipant(accountID, isMultipleParticipantReport, shouldFallbackToHidden) || user.login || ''; + const displayName = getDisplayNameForParticipant(accountID, isMultipleParticipantReport) || user.login || ''; const avatar = UserUtils.getDefaultAvatar(accountID); let pronouns = user.pronouns; diff --git a/src/pages/home/report/ParticipantLocalTime.js b/src/pages/home/report/ParticipantLocalTime.js index 2e000c2de1d3..058346287b11 100644 --- a/src/pages/home/report/ParticipantLocalTime.js +++ b/src/pages/home/report/ParticipantLocalTime.js @@ -45,10 +45,6 @@ function ParticipantLocalTime(props) { const reportRecipientDisplayName = lodashGet(props, 'participant.firstName') || lodashGet(props, 'participant.displayName'); - if (!reportRecipientDisplayName) { - return null; - } - return ( - _.chain(props.iou.participants) - .map((participant) => { - const isPolicyExpenseChat = lodashGet(participant, 'isPolicyExpenseChat', false); - return isPolicyExpenseChat ? OptionsListUtils.getPolicyExpenseReportOption(participant) : OptionsListUtils.getParticipantsOption(participant, props.personalDetails); - }) - .filter((participant) => !!participant.login) - .value(), + _.map(props.iou.participants, (participant) => { + const isPolicyExpenseChat = lodashGet(participant, 'isPolicyExpenseChat', false); + return isPolicyExpenseChat ? OptionsListUtils.getPolicyExpenseReportOption(participant) : OptionsListUtils.getParticipantsOption(participant, props.personalDetails); + }), [props.iou.participants, props.personalDetails], ); const isPolicyExpenseChat = useMemo(() => ReportUtils.isPolicyExpenseChat(ReportUtils.getRootParentReport(props.report)), [props.report]);