diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index 39d583106d51..d63b3384c933 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -2262,20 +2262,17 @@ function filterOptions(options: Options, searchInputValue: string): Options { if (item.alternateText) { values.push(item.alternateText); } - values = values.concat(getParticipantsLoginsArray(item)); } else if (!!item.isChatRoom || !!item.isPolicyExpenseChat) { if (item.subtitle) { values.push(item.subtitle); } - values = values.concat(getParticipantsLoginsArray(item)); - } else { - values = values.concat(getParticipantsLoginsArray(item)); } + values = values.concat(getParticipantsLoginsArray(item)); return uniqFast(values); }); const personalDetails = filterArrayByMatch(items.personalDetails, term, (item) => - uniqFast([item.participantsList?.[0]?.displayName ?? '', item.login?.replace(emailRegex, '') ?? '']), + uniqFast([item.participantsList?.[0]?.displayName ?? '', item.login ?? '', item.login?.replace(emailRegex, '') ?? '']), ); return { diff --git a/src/libs/filterArrayByMatch.ts b/src/libs/filterArrayByMatch.ts index c87ad8fac180..3abf82b6afab 100644 --- a/src/libs/filterArrayByMatch.ts +++ b/src/libs/filterArrayByMatch.ts @@ -106,7 +106,7 @@ function filterArrayByMatch(items: readonly T[], searchValue: string } } - if (itemRank >= MATCH_RANK.MATCHES) { + if (itemRank >= MATCH_RANK.MATCHES + 1) { filteredItems.push(item); } } diff --git a/tests/unit/OptionsListUtilsTest.ts b/tests/unit/OptionsListUtilsTest.ts index fa0175ffa8f3..af5782b1ca32 100644 --- a/tests/unit/OptionsListUtilsTest.ts +++ b/tests/unit/OptionsListUtilsTest.ts @@ -2609,11 +2609,12 @@ describe('OptionsListUtils', () => { const options = OptionsListUtils.getSearchOptions(OPTIONS, '', [CONST.BETAS.ALL]); const filteredOptions = OptionsListUtils.filterOptions(options, searchText); - expect(filteredOptions.recentReports.length).toBe(4); + expect(filteredOptions.recentReports.length).toBe(5); expect(filteredOptions.recentReports[0].text).toBe('Invisible Woman'); expect(filteredOptions.recentReports[1].text).toBe('Spider-Man'); expect(filteredOptions.recentReports[2].text).toBe('Black Widow'); expect(filteredOptions.recentReports[3].text).toBe('Mister Fantastic'); + expect(filteredOptions.recentReports[4].text).toBe("SHIELD's workspace (archived)"); }); it('should filter users by email', () => {