From d01e567e5e5e0f2a9a57524d7ab1a970698c487f Mon Sep 17 00:00:00 2001 From: Nam Le Date: Wed, 20 Sep 2023 21:15:58 +0700 Subject: [PATCH 1/5] fix select workspace request money --- .../MoneyRequestParticipantsSelector.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js index 4f761e92eaf5..370b6a359a1d 100755 --- a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js +++ b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js @@ -223,7 +223,7 @@ function MoneyRequestParticipantsSelector({ Boolean(newChatOptions.userToInvite), searchTerm.trim(), maxParticipantsReached, - _.some(participants, (participant) => participant.login.toLowerCase().includes(searchTerm.trim().toLowerCase())), + _.some(participants, (participant) => participant.login && participant.login.toLowerCase().includes(searchTerm.trim().toLowerCase())), ); const isOptionsDataReady = ReportUtils.isReportDataReady() && OptionsListUtils.isPersonalDetailsReady(personalDetails); From ef7190abc4125073c8a31bb5ce171306bea81dba Mon Sep 17 00:00:00 2001 From: Nam Le Date: Wed, 20 Sep 2023 22:46:44 +0700 Subject: [PATCH 2/5] fix search by name --- src/libs/OptionsListUtils.js | 2 +- .../MoneyRequestParticipantsSelector.js | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index 8587ae1933db..01b17facbdd6 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -1288,7 +1288,7 @@ function getHeaderMessage(hasSelectableOptions, hasUserToInvite, searchValue, ma if (/@/.test(searchValue) && !isValidEmail) { return Localize.translate(preferredLocale, 'messages.errorMessageInvalidEmail'); } - if (hasMatchedParticipant && (isValidEmail || isValidPhone)) { + if (hasMatchedParticipant) { return ''; } return Localize.translate(preferredLocale, 'common.noResultsFound'); diff --git a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js index 370b6a359a1d..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 && participant.login.toLowerCase().includes(searchTerm.trim().toLowerCase())), + _.some(participants, (participant) => participant.searchText.toLowerCase().includes(searchTerm.trim().toLowerCase())), ); const isOptionsDataReady = ReportUtils.isReportDataReady() && OptionsListUtils.isPersonalDetailsReady(personalDetails); From 7148c84115812f9de419542d56ff1cf9b3877790 Mon Sep 17 00:00:00 2001 From: Nam Le Date: Wed, 20 Sep 2023 23:02:59 +0700 Subject: [PATCH 3/5] fix check search text in case select request money --- .../MoneyRequestParticipantsSelector.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js index 55575a32aa18..854dc7a1acab 100755 --- a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js +++ b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js @@ -232,7 +232,7 @@ function MoneyRequestParticipantsSelector({ Boolean(newChatOptions.userToInvite), searchTerm.trim(), maxParticipantsReached, - _.some(participants, (participant) => participant.searchText.toLowerCase().includes(searchTerm.trim().toLowerCase())), + _.some(participants, (participant) => participant.searchText && participant.searchText.toLowerCase().includes(searchTerm.trim().toLowerCase())), ); const isOptionsDataReady = ReportUtils.isReportDataReady() && OptionsListUtils.isPersonalDetailsReady(personalDetails); From a1c10b3542de96a6c6c524eb61690e096b264139 Mon Sep 17 00:00:00 2001 From: Nam Le Date: Thu, 21 Sep 2023 01:50:15 +0700 Subject: [PATCH 4/5] fix add get searchText --- src/libs/OptionsListUtils.js | 2 ++ .../MoneyRequestParticipantsSelector.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index 01b17facbdd6..5fb886c7b8c9 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 854dc7a1acab..55575a32aa18 100755 --- a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js +++ b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js @@ -232,7 +232,7 @@ function MoneyRequestParticipantsSelector({ Boolean(newChatOptions.userToInvite), searchTerm.trim(), maxParticipantsReached, - _.some(participants, (participant) => participant.searchText && participant.searchText.toLowerCase().includes(searchTerm.trim().toLowerCase())), + _.some(participants, (participant) => participant.searchText.toLowerCase().includes(searchTerm.trim().toLowerCase())), ); const isOptionsDataReady = ReportUtils.isReportDataReady() && OptionsListUtils.isPersonalDetailsReady(personalDetails); From 586e9979adb15bc170197f7a21d6fe763edf1628 Mon Sep 17 00:00:00 2001 From: Nam Le Date: Thu, 21 Sep 2023 02:06:09 +0700 Subject: [PATCH 5/5] revert search --- src/libs/OptionsListUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index 5fb886c7b8c9..bae1f6b9e80a 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -1290,7 +1290,7 @@ function getHeaderMessage(hasSelectableOptions, hasUserToInvite, searchValue, ma if (/@/.test(searchValue) && !isValidEmail) { return Localize.translate(preferredLocale, 'messages.errorMessageInvalidEmail'); } - if (hasMatchedParticipant) { + if (hasMatchedParticipant && (isValidEmail || isValidPhone)) { return ''; } return Localize.translate(preferredLocale, 'common.noResultsFound');