@@ -243,6 +243,7 @@ type GetValidReportsReturnTypeCombined = {
243243
244244type GetOptionsConfig = {
245245 excludeLogins ?: Record < string , boolean > ;
246+ includeCurrentUser ?: boolean ;
246247 includeRecentReports ?: boolean ;
247248 includeSelectedOptions ?: boolean ;
248249 recentAttendees ?: Option [ ] ;
@@ -251,7 +252,6 @@ type GetOptionsConfig = {
251252 searchString ?: string ;
252253 maxElements ?: number ;
253254 includeUserToInvite ?: boolean ;
254- includeCurrentUser ?: boolean ;
255255} & GetValidReportsConfig ;
256256
257257type GetUserToInviteConfig = {
@@ -2360,7 +2360,7 @@ function formatSectionsFromSearchTerm(
23602360 // This will add them to the list of options, deduping them if they already exist in the other lists
23612361 const selectedParticipantsWithoutDetails = selectedOptions . filter ( ( participant ) => {
23622362 const accountID = participant . accountID ?? null ;
2363- const searchTerms = currentUserAccountID === accountID ? getCurrentUserSearchTerms ( participant ) : getPersonalDetailSearchTerms ( participant ) ;
2363+ const searchTerms = getPersonalDetailSearchTerms ( participant ) ;
23642364 const isPartOfSearchTerm = searchTerms . join ( ' ' ) . toLowerCase ( ) . includes ( cleanSearchTerm ) ;
23652365 const isReportInRecentReports = filteredRecentReports . some ( ( report ) => report . accountID === accountID ) || filteredWorkspaceChats . some ( ( report ) => report . accountID === accountID ) ;
23662366 const isReportInPersonalDetails = filteredPersonalDetails . some ( ( personalDetail ) => personalDetail . accountID === accountID ) ;
@@ -2396,10 +2396,13 @@ function getFirstKeyForList(data?: Option[] | null) {
23962396}
23972397
23982398function getPersonalDetailSearchTerms ( item : Partial < OptionData > ) {
2399+ if ( item . accountID === currentUserAccountID ) {
2400+ return getCurrentUserSearchTerms ( item ) ;
2401+ }
23992402 return [ item . participantsList ?. [ 0 ] ?. displayName ?? '' , item . login ?? '' , item . login ?. replace ( CONST . EMAIL_SEARCH_REGEX , '' ) ?? '' ] ;
24002403}
24012404
2402- function getCurrentUserSearchTerms ( item : OptionData ) {
2405+ function getCurrentUserSearchTerms ( item : Partial < OptionData > ) {
24032406 return [ item . text ?? '' , item . login ?? '' , item . login ?. replace ( CONST . EMAIL_SEARCH_REGEX , '' ) ?? '' , translateLocal ( 'common.you' ) , translateLocal ( 'common.me' ) ] ;
24042407}
24052408
0 commit comments