@@ -127,6 +127,7 @@ import {
127
127
shouldReportShowSubscript ,
128
128
} from './ReportUtils' ;
129
129
import type { OptionData } from './ReportUtils' ;
130
+ import StringUtils from './StringUtils' ;
130
131
import { getTaskCreatedMessage , getTaskReportActionMessage } from './TaskUtils' ;
131
132
import { generateAccountID } from './UserUtils' ;
132
133
@@ -1839,29 +1840,31 @@ function filteredPersonalDetailsOfRecentReports(recentReports: OptionData[], per
1839
1840
* Filters options based on the search input value
1840
1841
*/
1841
1842
function filterReports ( reports : OptionData [ ] , searchTerms : string [ ] ) : OptionData [ ] {
1843
+ const normalizedSearchTerms = searchTerms . map ( ( term ) => StringUtils . normalizeAccents ( term ) ) ;
1842
1844
// We search eventually for multiple whitespace separated search terms.
1843
1845
// We start with the search term at the end, and then narrow down those filtered search results with the next search term.
1844
1846
// We repeat (reduce) this until all search terms have been used:
1845
- const filteredReports = searchTerms . reduceRight (
1847
+ const filteredReports = normalizedSearchTerms . reduceRight (
1846
1848
( items , term ) =>
1847
1849
filterArrayByMatch ( items , term , ( item ) => {
1848
1850
const values : string [ ] = [ ] ;
1849
1851
if ( item . text ) {
1850
- values . push ( item . text ) ;
1852
+ values . push ( StringUtils . normalizeAccents ( item . text ) ) ;
1853
+ values . push ( StringUtils . normalizeAccents ( item . text ) . replace ( / [ ' - ] / g, '' ) ) ;
1851
1854
}
1852
1855
1853
1856
if ( item . login ) {
1854
- values . push ( item . login ) ;
1855
- values . push ( item . login . replace ( CONST . EMAIL_SEARCH_REGEX , '' ) ) ;
1857
+ values . push ( StringUtils . normalizeAccents ( item . login ) ) ;
1858
+ values . push ( StringUtils . normalizeAccents ( item . login . replace ( CONST . EMAIL_SEARCH_REGEX , '' ) ) ) ;
1856
1859
}
1857
1860
1858
1861
if ( item . isThread ) {
1859
1862
if ( item . alternateText ) {
1860
- values . push ( item . alternateText ) ;
1863
+ values . push ( StringUtils . normalizeAccents ( item . alternateText ) ) ;
1861
1864
}
1862
1865
} else if ( ! ! item . isChatRoom || ! ! item . isPolicyExpenseChat ) {
1863
1866
if ( item . subtitle ) {
1864
- values . push ( item . subtitle ) ;
1867
+ values . push ( StringUtils . normalizeAccents ( item . subtitle ) ) ;
1865
1868
}
1866
1869
}
1867
1870
@@ -2125,6 +2128,7 @@ export {
2125
2128
filterWorkspaceChats ,
2126
2129
orderWorkspaceOptions ,
2127
2130
filterSelfDMChat ,
2131
+ filterReports ,
2128
2132
} ;
2129
2133
2130
2134
export type { Section , SectionBase , MemberForList , Options , OptionList , SearchOption , PayeePersonalDetails , Option , OptionTree , ReportAndPersonalDetailOptions , GetUserToInviteConfig } ;
0 commit comments