Skip to content

Commit

Permalink
Merge pull request #24222 from luckyman0305/lucky
Browse files Browse the repository at this point in the history
Split bill - 'No results found' appears
  • Loading branch information
madmax330 committed Aug 10, 2023
2 parents ff423aa + ba95ec6 commit 774b78c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1021,9 +1021,10 @@ function getMemberInviteOptions(personalDetails, betas = [], searchValue = '', e
* @param {Boolean} hasUserToInvite
* @param {String} searchValue
* @param {Boolean} [maxParticipantsReached]
* @param {Boolean} [hasMatchedParticipant]
* @return {String}
*/
function getHeaderMessage(hasSelectableOptions, hasUserToInvite, searchValue, maxParticipantsReached = false) {
function getHeaderMessage(hasSelectableOptions, hasUserToInvite, searchValue, maxParticipantsReached = false, hasMatchedParticipant = false) {
if (maxParticipantsReached) {
return Localize.translate(preferredLocale, 'common.maxParticipantsReached', {count: CONST.REPORT.MAXIMUM_PARTICIPANTS});
}
Expand All @@ -1045,7 +1046,9 @@ function getHeaderMessage(hasSelectableOptions, hasUserToInvite, searchValue, ma
if (/@/.test(searchValue) && !isValidEmail) {
return Localize.translate(preferredLocale, 'messages.errorMessageInvalidEmail');
}

if (hasMatchedParticipant && (isValidEmail || isValidPhone)) {
return '';
}
return Localize.translate(preferredLocale, 'common.noResultsFound');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function MoneyRequestParticipantsSplitSelector({betas, participants, personalDet
if (isOptionInList) {
newSelectedOptions = _.reject(participants, (selectedOption) => selectedOption.accountID === option.accountID);
} else {
newSelectedOptions = [...participants, {accountID: option.accountID, login: option.login, selected: true}];
newSelectedOptions = [...participants, {accountID: option.accountID, login: option.login, selected: true, searchText: option.searchText}];
}

onAddParticipants(newSelectedOptions);
Expand All @@ -150,6 +150,7 @@ function MoneyRequestParticipantsSplitSelector({betas, participants, personalDet
Boolean(newChatOptions.userToInvite),
searchTerm,
maxParticipantsReached,
_.some((participant) => participant.searchText.toLowerCase().includes(searchTerm.toLowerCase())),
);
const isOptionsDataReady = ReportUtils.isReportDataReady() && OptionsListUtils.isPersonalDetailsReady(personalDetails);

Expand Down

0 comments on commit 774b78c

Please sign in to comment.