Skip to content

Commit

Permalink
Merge pull request #38887 from abzokhattab/enable-searching-for-works…
Browse files Browse the repository at this point in the history
…paces-by-participants

Enable searching for workspaces/rooms by their participants
  • Loading branch information
youssef-lr authored Apr 4, 2024
2 parents 3ff3626 + 3bc93b8 commit 42ee04c
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/libs/OptionsListUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -443,20 +443,19 @@ function getSearchText(
): string {
let searchTerms: string[] = [];

if (!isChatRoomOrPolicyExpenseChat) {
for (const personalDetail of personalDetailList) {
if (personalDetail.login) {
// The regex below is used to remove dots only from the local part of the user email (local-part@domain)
// so that we can match emails that have dots without explicitly writing the dots (e.g: fistlast@domain will match first.last@domain)
// More info https://github.com/Expensify/App/issues/8007
searchTerms = searchTerms.concat([
PersonalDetailsUtils.getDisplayNameOrDefault(personalDetail, '', false),
personalDetail.login,
personalDetail.login.replace(/\.(?=[^\s@]*@)/g, ''),
]);
}
for (const personalDetail of personalDetailList) {
if (personalDetail.login) {
// The regex below is used to remove dots only from the local part of the user email (local-part@domain)
// so that we can match emails that have dots without explicitly writing the dots (e.g: fistlast@domain will match first.last@domain)
// More info https://github.com/Expensify/App/issues/8007
searchTerms = searchTerms.concat([
PersonalDetailsUtils.getDisplayNameOrDefault(personalDetail, '', false),
personalDetail.login,
personalDetail.login.replace(/\.(?=[^\s@]*@)/g, ''),
]);
}
}

if (report) {
Array.prototype.push.apply(searchTerms, reportName.split(/[,\s]/));

Expand Down

0 comments on commit 42ee04c

Please sign in to comment.