diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index 654bc7054cb..a5185d8352a 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -758,8 +758,17 @@ function getOptions( // Finally check to see if this option is a match for the provided search string if we have one const {searchText, participantsList, isChatRoom} = reportOption; const participantNames = getParticipantNames(participantsList); - if (searchValue && !isSearchStringMatch(searchValue, searchText, participantNames, isChatRoom)) { - continue; + + if (searchValue) { + // Determine if the search is happening within a chat room and starts with the report ID + const isReportIdSearch = isChatRoom && Str.startsWith(reportOption.reportID, searchValue); + + // Check if the search string matches the search text or participant names considering the type of the room + const isSearchMatch = isSearchStringMatch(searchValue, searchText, participantNames, isChatRoom); + + if (!isReportIdSearch && !isSearchMatch) { + continue; + } } recentReportOptions.push(reportOption); @@ -1044,7 +1053,7 @@ function getHeaderMessage(hasSelectableOptions, hasUserToInvite, searchValue, ma const isValidEmail = Str.isValidEmail(searchValue); - if (searchValue && CONST.REGEX.DIGITS_AND_PLUS.test(searchValue) && !isValidPhone) { + if (searchValue && CONST.REGEX.DIGITS_AND_PLUS.test(searchValue) && !isValidPhone && !hasSelectableOptions) { return Localize.translate(preferredLocale, 'messages.errorMessageInvalidPhone'); }