diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index 8587ae1933db..bae1f6b9e80a 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -114,6 +114,7 @@ function getPolicyExpenseReportOption(report) { ], selected: report.selected, isPolicyExpenseChat: true, + searchText: report.searchText, }; } @@ -226,6 +227,7 @@ function getParticipantsOption(participant, personalDetails) { ], phoneNumber: lodashGet(detail, 'phoneNumber', ''), selected: participant.selected, + searchText: participant.searchText, }; } diff --git a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js index 4f761e92eaf5..55575a32aa18 100755 --- a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js +++ b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js @@ -158,7 +158,9 @@ function MoneyRequestParticipantsSelector({ * @param {Object} option */ const addSingleParticipant = (option) => { - onAddParticipants([{accountID: option.accountID, login: option.login, isPolicyExpenseChat: option.isPolicyExpenseChat, reportID: option.reportID, selected: true}]); + onAddParticipants([ + {accountID: option.accountID, login: option.login, isPolicyExpenseChat: option.isPolicyExpenseChat, reportID: option.reportID, selected: true, searchText: option.searchText}, + ]); navigateToRequest(); }; @@ -187,7 +189,14 @@ function MoneyRequestParticipantsSelector({ } else { newSelectedOptions = [ ...participants, - {accountID: option.accountID, login: option.login, isPolicyExpenseChat: option.isPolicyExpenseChat, reportID: option.reportID, selected: true}, + { + accountID: option.accountID, + login: option.login, + isPolicyExpenseChat: option.isPolicyExpenseChat, + reportID: option.reportID, + selected: true, + searchText: option.searchText, + }, ]; } @@ -223,7 +232,7 @@ function MoneyRequestParticipantsSelector({ Boolean(newChatOptions.userToInvite), searchTerm.trim(), maxParticipantsReached, - _.some(participants, (participant) => participant.login.toLowerCase().includes(searchTerm.trim().toLowerCase())), + _.some(participants, (participant) => participant.searchText.toLowerCase().includes(searchTerm.trim().toLowerCase())), ); const isOptionsDataReady = ReportUtils.isReportDataReady() && OptionsListUtils.isPersonalDetailsReady(personalDetails);